Define app_name and app_uuid as constants (#7534)

* Set a constant on each class for app_name and app_uuid
* Update the database class to use the app_uuid and app_name
* Update the classes to use the database::new()
* Remove the instances of 'new database'
This commit is contained in:
FusionPBX
2025-09-30 21:37:09 -06:00
committed by GitHub
parent 6485b18822
commit 2fe8b65988
69 changed files with 2571 additions and 2809 deletions

View File

@@ -29,6 +29,12 @@
*/
class destinations {
/**
* declare constant variables
*/
const app_name = 'destinations';
const app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139';
/**
* declare public variables
*/
@@ -57,30 +63,28 @@
public function __construct($setting_array = []) {
//open a database connection
if (empty($setting_array['database'])) {
$this->database = database::new();
} else {
$this->database = $setting_array['database'];
}
if (empty($setting_array['database'])) {
$this->database = database::new();
} else {
$this->database = $setting_array['database'];
}
//set the domain details
$this->domain_uuid = $_SESSION['domain_uuid'] ?? '';
$this->user_uuid = $_SESSION['user_uuid'] ?? '';
//get the settings object
if (empty($setting_array['settings'])) {
$this->settings = new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
} else {
$this->settings = $setting_array['settings'];
}
if (empty($setting_array['settings'])) {
$this->settings = new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
} else {
$this->settings = $setting_array['settings'];
}
//assign private variables
$this->app_name = 'destinations';
$this->app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139';
$this->permission_prefix = 'destination_';
$this->list_page = 'destinations.php';
$this->table = 'destinations';
$this->uuid_prefix = 'destination_';
$this->permission_prefix = 'destination_';
$this->list_page = 'destinations.php';
$this->table = 'destinations';
$this->uuid_prefix = 'destination_';
}
/**
@@ -1080,8 +1084,6 @@
$p->add('dialplan_detail_delete', 'temp');
//execute delete
$this->database->app_name = $this->app_name;
$this->database->app_uuid = $this->app_uuid;
$this->database->delete($array);
unset($array);