]> git.mxchange.org Git - friendica.git/blobdiff - bin/worker.php
Issue 6297 - and again template stuff
[friendica.git] / bin / worker.php
index d821fe626a6b47183ed6937df97544f385af8b33..9ae2f68b3e6ae8a0fbe994b6fe47bf834aee2bb2 100755 (executable)
@@ -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();