Re-use the Database connection

This commit is contained in:
FusionPBX
2024-08-29 03:35:38 -06:00
committed by GitHub
parent 9347d682bf
commit e0ed81a5ba
22 changed files with 87 additions and 88 deletions

View File

@@ -37,13 +37,15 @@ Mark J Crane <markjcrane@fusionpbx.com>
exit;
}
//connect to the database
$database = new database;
//add multi-lingual support
$language = new text;
$text = $language->get();
// retrieve software uuid
$sql = "select software_uuid, software_url, software_version from v_software";
$database = new database;
$row = $database->select($sql, null, 'row');
if (is_array($row) && sizeof($row) != 0) {
$software_uuid = $row["software_uuid"];
@@ -86,7 +88,6 @@ Mark J Crane <markjcrane@fusionpbx.com>
case "mysql" : $sql = "select version();"; break;
case "sqlite" : $sql = "select sqlite_version();"; break;
}
$database = new database;
$db_ver = $database->select($sql, null, 'column');
unset($sql);
@@ -155,7 +156,6 @@ Mark J Crane <markjcrane@fusionpbx.com>
// get local project notification participation flag
$sql = "select project_notifications from v_notifications";
$database = new database;
$current_project_notifications = $database->select($sql, null, 'row');
unset($sql);
@@ -182,7 +182,6 @@ Mark J Crane <markjcrane@fusionpbx.com>
if ($response['result'] == 'deleted') {
// set local project notification participation flag to false
$sql = "update v_notifications set project_notifications = 'false'";
$database = new database;
$database->execute($sql);
unset($sql);
}
@@ -242,7 +241,6 @@ Mark J Crane <markjcrane@fusionpbx.com>
if ($response['result'] == 'updated' || $response['result'] == 'inserted') {
// set local project notification participation flag to true
$sql = "update v_notifications set project_notifications = 'true'";
$database = new database;
$database->execute($sql);
unset($sql);
// set message
@@ -269,7 +267,6 @@ Mark J Crane <markjcrane@fusionpbx.com>
// check local project notification participation flag
$sql = "select project_notifications from v_notifications";
$database = new database;
$row = $database->select($sql, null, 'row');
if (is_array($row) && sizeof($row) != 0) {
$setting["project_notifications"] = $row["project_notifications"];