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:
@@ -12,10 +12,13 @@
|
||||
public $event_socket_password;
|
||||
|
||||
/**
|
||||
* Called when the object is created
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,8 +212,7 @@
|
||||
//get an array of the default settings
|
||||
$sql = "select * from v_default_settings ";
|
||||
$sql .= "where default_setting_category = 'switch' ";
|
||||
$database = new database;
|
||||
$default_settings = $database->select($sql, null, 'all');
|
||||
$default_settings = $this->database->select($sql, null, 'all');
|
||||
unset($sql);
|
||||
|
||||
//find the missing default settings
|
||||
@@ -251,10 +253,7 @@
|
||||
$p->add('default_setting_add', 'temp');
|
||||
|
||||
//execute insert
|
||||
$database = new database;
|
||||
$database->app_name = 'switch_settings';
|
||||
$database->app_uuid = '84e91084-a227-43cd-ae99-a0f8ed61eb8b';
|
||||
$database->save($array);
|
||||
$this->database->save($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
$p->delete('default_setting_add', 'temp');
|
||||
|
||||
Reference in New Issue
Block a user