Fix cache's settings object

This commit is contained in:
markjcrane
2026-05-14 16:04:26 +00:00
parent 0c57b13358
commit 21b55e229b
2 changed files with 13 additions and 19 deletions
+8
View File
@@ -289,6 +289,14 @@
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Location for the file cache."; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Location for the file cache.";
$y++; $y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "55e9def3-f8d4-4201-84b7-3b30cb4f21ab";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "cache";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "syslog";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Log cache requests to syslog.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "31b60c5f-e501-4982-893b-b56ef4ef5b56"; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "31b60c5f-e501-4982-893b-b56ef4ef5b56";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "log"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "log";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "enabled"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "enabled";
+5 -19
View File
@@ -24,23 +24,9 @@ class cache {
//get the settings //get the settings
$this->settings = $settings; $this->settings = $settings;
$this->method = $this->setting('method'); $this->method = $this->settings->get('cache', 'method', 'file');
$this->syslog = $this->setting('syslog'); $this->syslog = $this->settings->get('cache', 'syslog', false);
$this->location = $this->setting('location'); $this->location = $this->settings->get('cache', 'location', '/var/cache/fusionpbx');
$this->method = 'file';
$this->syslog = 'false';
$this->location = '/var/cache/fusionpbx';
}
/**
* Get a specific cache setting from the settings array.
*
* @param string $subcategory The subcategory of the cache setting to retrieve.
*
* @return mixed The value of the specified cache setting, or null if it does not exist.
*/
private function setting($subcategory) {
return $this->settings->get('cache', $subcategory);
} }
/** /**
@@ -131,7 +117,7 @@ class cache {
public function delete($key) { public function delete($key) {
//debug information //debug information
if ($this->syslog === "true") { if ($this->syslog == true) {
openlog("fusionpbx", LOG_PID | LOG_PERROR, LOG_USER); openlog("fusionpbx", LOG_PID | LOG_PERROR, LOG_USER);
syslog(LOG_WARNING, "debug: cache: [key: " . $key . ", script: " . $_SERVER['SCRIPT_NAME'] . ", line: " . __line__ . "]"); syslog(LOG_WARNING, "debug: cache: [key: " . $key . ", script: " . $_SERVER['SCRIPT_NAME'] . ", line: " . __line__ . "]");
closelog(); closelog();
@@ -204,7 +190,7 @@ class cache {
public function flush() { public function flush() {
//debug information //debug information
if ($this->syslog === "true") { if ($this->syslog == true) {
openlog("fusionpbx", LOG_PID | LOG_PERROR, LOG_USER); openlog("fusionpbx", LOG_PID | LOG_PERROR, LOG_USER);
syslog(LOG_WARNING, "debug: cache: [flush: all, script: " . $_SERVER['SCRIPT_NAME'] . ", line: " . __line__ . "]"); syslog(LOG_WARNING, "debug: cache: [flush: all, script: " . $_SERVER['SCRIPT_NAME'] . ", line: " . __line__ . "]");
closelog(); closelog();