]> git.mxchange.org Git - friendica.git/blobdiff - bin/worker.php
replaced with notify constants
[friendica.git] / bin / worker.php
index 3d2fc3fa9fd13c0df36d0170ccf8205c3cf52241..106c9b81f17ece58c7977f88b2803f7e57fcd393 100755 (executable)
@@ -2,12 +2,15 @@
 <?php
 /**
  * @file bin/worker.php
- * @brief Starts the background processing
+ * Starts the background processing
  */
+
+use Dice\Dice;
 use Friendica\App;
-use Friendica\Core\Config;
+use Friendica\Core\Update;
 use Friendica\Core\Worker;
-use Friendica\Core\L10n;
+use Friendica\DI;
+use Psr\Log\LoggerInterface;
 
 // Get options
 $shortopts = 'sn';
@@ -26,28 +29,29 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
        chdir($directory);
 }
 
-require_once "boot.php";
+require dirname(__DIR__) . '/vendor/autoload.php';
 
-$a = new App(dirname(__DIR__));
+$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
+$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['worker']]);
 
-$lang = L10n::getBrowserLanguage();
-L10n::loadTranslationTable($lang);
+DI::init($dice);
+$a = DI::app();
 
 // Check the database structure and possibly fixes it
-check_db(true);
+Update::check($a->getBasePath(), true, DI::mode());
 
 // Quit when in maintenance
-if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) {
+if (!DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
        return;
 }
 
-$a->setBaseURL(Config::get('system', 'url'));
+DI::baseUrl()->saveByURL(DI::config()->get('system', 'url'));
 
 $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);