Replace worker_daemon_mode config entry with key-value entry
authorPhilipp <admin@philipp.info>
Thu, 29 Dec 2022 19:34:19 +0000 (20:34 +0100)
committerPhilipp <admin@philipp.info>
Thu, 29 Dec 2022 20:53:57 +0000 (21:53 +0100)
bin/daemon.php
src/Core/Worker/Daemon.php
update.php

index d5ef02a..b7085a4 100755 (executable)
@@ -115,7 +115,7 @@ if (is_readable($pidfile)) {
 }
 
 if (empty($pid) && in_array($mode, ['stop', 'status'])) {
-       DI::config()->set('system', 'worker_daemon_mode', false);
+       DI::keyValue()->set('worker_daemon_mode', false);
        die("Pidfile wasn't found. Is the daemon running?\n");
 }
 
@@ -137,7 +137,7 @@ if ($mode == 'stop') {
 
        Logger::notice('Worker daemon process was killed', ['pid' => $pid]);
 
-       DI::config()->set('system', 'worker_daemon_mode', false);
+       DI::keyValue()->set('worker_daemon_mode', false);
        die("Worker daemon process $pid was killed.\n");
 }
 
@@ -181,7 +181,7 @@ if (!$foreground) {
        DBA::connect();
 }
 
-DI::config()->set('system', 'worker_daemon_mode', true);
+DI::keyValue()->set('worker_daemon_mode', true);
 
 // Just to be sure that this script really runs endlessly
 set_time_limit(0);
index 858acc2..7b4c358 100644 (file)
@@ -47,7 +47,7 @@ class Daemon
                        return true;
                }
 
-               $daemon_mode = DI::config()->get('system', 'worker_daemon_mode', false, true);
+               $daemon_mode = DI::keyValue()->get('worker_daemon_mode') ?? false;
                if ($daemon_mode) {
                        return $daemon_mode;
                }
index 632d173..ff3b6b5 100644 (file)
@@ -1149,11 +1149,12 @@ function update_1502()
 function update_1505()
 {
        $conditions = [
-               "(`k` LIKE ?) OR (`k` = ?) OR (`cat` = ? AND `k` LIKE ?)",
+               "(`cat` = ?) AND ((`k` LIKE ?) OR (`k` = ?) OR (`k` LIKE ?) OR (`k` = ?))",
+               "system",
                "post_update_%",
                "worker_last_cleaned",
-               "system",
-               "last%"
+               "last%",
+               "worker_daemon_mode",
        ];
 
        $postUpdateEntries = DBA::selectToArray('config', ['k', 'v'], $conditions);