From 21b55e229bfa5fb922cb40051a29d33aa87f5819 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 14 May 2026 16:04:26 +0000 Subject: [PATCH] Fix cache's settings object --- core/default_settings/app_config.php | 8 ++++++++ resources/classes/cache.php | 24 +++++------------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/core/default_settings/app_config.php b/core/default_settings/app_config.php index 7591667ba..ad0af8c3a 100644 --- a/core/default_settings/app_config.php +++ b/core/default_settings/app_config.php @@ -289,6 +289,14 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Location for the file cache."; $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_category'] = "log"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "enabled"; diff --git a/resources/classes/cache.php b/resources/classes/cache.php index a3f242bc2..1c060cb6b 100644 --- a/resources/classes/cache.php +++ b/resources/classes/cache.php @@ -24,23 +24,9 @@ class cache { //get the settings $this->settings = $settings; - $this->method = $this->setting('method'); - $this->syslog = $this->setting('syslog'); - $this->location = $this->setting('location'); - $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); + $this->method = $this->settings->get('cache', 'method', 'file'); + $this->syslog = $this->settings->get('cache', 'syslog', false); + $this->location = $this->settings->get('cache', 'location', '/var/cache/fusionpbx'); } /** @@ -131,7 +117,7 @@ class cache { public function delete($key) { //debug information - if ($this->syslog === "true") { + if ($this->syslog == true) { openlog("fusionpbx", LOG_PID | LOG_PERROR, LOG_USER); syslog(LOG_WARNING, "debug: cache: [key: " . $key . ", script: " . $_SERVER['SCRIPT_NAME'] . ", line: " . __line__ . "]"); closelog(); @@ -204,7 +190,7 @@ class cache { public function flush() { //debug information - if ($this->syslog === "true") { + if ($this->syslog == true) { openlog("fusionpbx", LOG_PID | LOG_PERROR, LOG_USER); syslog(LOG_WARNING, "debug: cache: [flush: all, script: " . $_SERVER['SCRIPT_NAME'] . ", line: " . __line__ . "]"); closelog();