use loose comparison instead of strict comparison (#7064)

Update comparison checks when testing the database status and
add a unified log message with a more detailed message from the
database when there is a failure

Authored-by: Tim Fry <tim@fusionpbx.com>
This commit is contained in:
frytimo
2024-07-23 22:58:13 -03:00
committed by GitHub
parent 64c6527ab8
commit 46abe4897c
5 changed files with 32 additions and 22 deletions

View File

@@ -304,7 +304,7 @@ if (!class_exists('users')) {
$database->execute($sql);
$code = $database->message['code'] ?? 0;
if ($code == 200) {
maintenance_service::log_write(self::class, "Removed database entries older than $retention_days", $domain_uuid);
maintenance_service::log_write(self::class, "Successfully removed entries older than $retention_days", $domain_uuid);
} else {
$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);