Replace worker_daemon_mode config entry with key-value entry

This commit is contained in:
Philipp Holzer 2022-12-29 20:34:19 +01:00
parent 6b3265742a
commit b227d65dfc
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
3 changed files with 8 additions and 7 deletions

View file

@ -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);

View 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;
}

View 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);