$options = getopt($shortopts, $longopts);
// Ensure that daemon.php is executed from the base path of the installation
-if (!file_exists('boot.php') && (sizeof($_SERVER['argv']) != 0)) {
+if (!file_exists('index.php') && (sizeof($_SERVER['argv']) != 0)) {
$directory = dirname($_SERVER['argv'][0]);
if (substr($directory, 0, 1) != '/') {
if (empty(DI::config()->get('system', 'pidfile'))) {
die(<<<TXT
Please set system.pidfile in config/local.config.php. For example:
-
- 'system' => [
+
+ 'system' => [
'pidfile' => '/path/to/daemon.pid',
],
TXT
}
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");
}
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");
}
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);
}
if ($do_cron || (!DI::system()->isMaxLoadReached() && Worker::entriesExists() && Worker::isReady())) {
- Worker::coolDown();
Worker::spawnWorker($do_cron);
} else {
Logger::info('Cool down for 5 seconds', ['pid' => $pid]);