X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fworker.php;h=9ae2f68b3e6ae8a0fbe994b6fe47bf834aee2bb2;hb=768ad3cfd9347f6121094f9fcfae430d21317bbb;hp=d821fe626a6b47183ed6937df97544f385af8b33;hpb=f2b97f932095ed76656be09e3ba94646187808dc;p=friendica.git diff --git a/bin/worker.php b/bin/worker.php index d821fe626a..9ae2f68b3e 100755 --- a/bin/worker.php +++ b/bin/worker.php @@ -4,25 +4,24 @@ * @file bin/worker.php * @brief Starts the background processing */ - use Friendica\App; -use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; +use Friendica\Core\Update; // Get options -$shortopts = 'sc'; -$longopts = ['spawn', 'cron']; +$shortopts = 'sn'; +$longopts = ['spawn', 'no_cron']; $options = getopt($shortopts, $longopts); // Ensure that worker.php is executed from the base path of the installation if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) { $directory = dirname($_SERVER["argv"][0]); - if (substr($directory, 0, 1) != "/") { - $directory = $_SERVER["PWD"]."/".$directory; + if (substr($directory, 0, 1) != '/') { + $directory = $_SERVER["PWD"] . '/' . $directory; } - $directory = realpath($directory."/.."); + $directory = realpath($directory . '/..'); chdir($directory); } @@ -31,19 +30,15 @@ require_once "boot.php"; $a = new App(dirname(__DIR__)); -Config::load(); - // Check the database structure and possibly fixes it -check_db(true); +Update::check(true); // Quit when in maintenance -if (Config::get('system', 'maintenance', false, true)) { +if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) { return; } -$a->set_baseurl(Config::get('system', 'url')); - -Addon::loadHooks(); +$a->setBaseURL(Config::get('system', 'url')); $spawn = array_key_exists('s', $options) || array_key_exists('spawn', $options); @@ -52,12 +47,10 @@ if ($spawn) { killme(); } -$run_cron = array_key_exists('c', $options) || array_key_exists('cron', $options); +$run_cron = !array_key_exists('n', $options) && !array_key_exists('no_cron', $options); Worker::processQueue($run_cron); Worker::unclaimProcess(); Worker::endProcess(); - -killme();