X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fworker.php;h=2b5915f471d4fc76b9fdfdee1bad2ff42318cea0;hb=73835118550f4bf9c0df510283c905f89224d612;hp=cb09a4929da9fe0c445baca4361445902687531f;hpb=a97b540ebb3f1d5bb5c18b4c0fb631443d03b5a7;p=friendica.git diff --git a/bin/worker.php b/bin/worker.php index cb09a4929d..2b5915f471 100755 --- a/bin/worker.php +++ b/bin/worker.php @@ -6,10 +6,10 @@ */ use Friendica\App; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Update; use Friendica\Core\Worker; -use Friendica\Core\L10n; +use Friendica\Factory; // Get options $shortopts = 'sn'; @@ -20,40 +20,33 @@ $options = getopt($shortopts, $longopts); 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); } -require_once "boot.php"; +require dirname(__DIR__) . '/vendor/autoload.php'; -$a = new App(dirname(__DIR__)); - -Config::load(); - -$lang = L10n::getBrowserLanguage(); -L10n::loadTranslationTable($lang); +$a = Factory\DependencyFactory::setUp('worker', dirname(__DIR__)); // Check the database structure and possibly fixes it -check_db(true); +Update::check($a->getBasePath(), true, $a->getMode()); // Quit when in maintenance -if (Config::get('system', 'maintenance', false, true)) { +if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) { return; } $a->setBaseURL(Config::get('system', 'url')); -Addon::loadHooks(); - $spawn = array_key_exists('s', $options) || array_key_exists('spawn', $options); if ($spawn) { Worker::spawnWorker(); - killme(); + exit(); } $run_cron = !array_key_exists('n', $options) && !array_key_exists('no_cron', $options); @@ -63,5 +56,3 @@ Worker::processQueue($run_cron); Worker::unclaimProcess(); Worker::endProcess(); - -killme();