Use the database more efficiently

This commit is contained in:
FusionPBX
2024-07-26 17:04:02 -06:00
committed by GitHub
parent e7e2f73004
commit a5d44ae44b
7 changed files with 52 additions and 72 deletions

View File

@@ -37,6 +37,9 @@
exit;
}
//initialize the database object
$database = new database;
//add multi-lingual support
$language = new text;
$text = $language->get();
@@ -117,7 +120,7 @@
$schema[$i]['fields'][] = $field_name;
}
}
$i++;
$i++;
}
}
@@ -246,14 +249,13 @@
//user selected fields
$fields = $_POST['fields'];
//set the domain_uuid
$domain_uuid = $_SESSION['domain_uuid'];
//get the users
$sql = "select * from v_users where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$users = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
@@ -272,7 +274,7 @@
foreach ($fields as $key => $value) {
//get the line
$result = str_getcsv($line, $delimiter, $enclosure);
//get the table and field name
$field_array = explode(".",$value);
$table_name = $field_array[0];
@@ -280,7 +282,7 @@
//echo "value: $value<br />\n";
//echo "table_name: $table_name<br />\n";
//echo "field_name: $field_name<br />\n";
//get the parent table name
$parent = get_parent($schema, $table_name);
@@ -322,7 +324,6 @@
if ($row_id === 1000) {
//save to the data
$database = new database;
$database->app_name = 'extensions';
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
$database->save($array);
@@ -342,7 +343,6 @@
//save to the data
if (!empty($array) && is_array($array)) {
$database = new database;
$database->app_name = 'extensions';
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
$database->save($array);
@@ -458,4 +458,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>