From 1c7df93020f4b605aecf54bf611b705669cfbd40 Mon Sep 17 00:00:00 2001 From: frytimo Date: Wed, 22 Oct 2025 11:59:15 -0300 Subject: [PATCH] Fix using keyword $this in static class voicemail (#7586) --- app/voicemails/resources/classes/voicemail.php | 17 +++++++++-------- app/xml_cdr/resources/classes/xml_cdr.php | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 4be6d99a87..ac8525817a 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -64,7 +64,7 @@ /** * Internal array structure that is populated from the database - * @var array Array of settings loaded from Default Settings + * @var settings A settings object loaded from Default Settings */ private $settings; @@ -845,7 +845,7 @@ } //encode subject - $template['template_subject'] = trim(iconv_mime_encode(null, $template['template_subject'], ['scheme'=>'B','output-charset'=>'utf-8', 'line-break-chars'=>"\n"]), ': '); + $template['template_subject'] = trim(iconv_mime_encode('', $template['template_subject'], ['scheme'=>'B','output-charset'=>'utf-8', 'line-break-chars'=>"\n"]), ': '); //determine voicemail message file path and type $voicemail_message_path = $switch_voicemail.'/default/'.$message['domain_name'].'/'.$message['voicemail_id']; @@ -1451,12 +1451,13 @@ //set table name for query //$table = self::TABLE; $table = 'voicemail_messages'; + $database = $settings->database(); //get a list of domains - $domains = maintenance::get_domains($this->database); + $domains = maintenance::get_domains($database); foreach ($domains as $domain_uuid => $domain_name) { //get domain settings - $domain_settings = new settings(['database' => $this->database, 'domain_uuid' => $domain_uuid]); + $domain_settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid]); //ensure we have a retention day $retention_days = $domain_settings->get('voicemail', maintenance::DATABASE_SUBCATEGORY, ''); @@ -1464,12 +1465,12 @@ //clear out old records $sql = "delete from v_{$table} WHERE to_timestamp(created_epoch) < NOW() - INTERVAL '{$retention_days} days'" . " and domain_uuid = '{$domain_uuid}'"; - $this->database->execute($sql); - $code = $this->database->message['code'] ?? 0; - if ($this->database->message['code'] == 200) { + $database->execute($sql); + $code = $database->message['code'] ?? 0; + if ($database->message['code'] == 200) { maintenance_service::log_write(self::class, "Successfully removed entries older than $retention_days", $domain_uuid); } else { - $message = $this->database->message['message'] ?? "An unknown error has occurred"; + $message = $database->message['message'] ?? "An unknown error has occurred"; maintenance_service::log_write(self::class, "Unable to remove old database records. Error message: $message ($code)", $domain_uuid, maintenance_service::LOG_ERROR); } } diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index e7a11bf5e3..b5aac5a753 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -76,7 +76,7 @@ /** * Internal array structure that is populated from the database - * @var array Array of settings loaded from Default Settings + * @var settings A settings object loaded from Default Settings */ private $settings;