]> git.mxchange.org Git - friendica.git/blobdiff - bin/worker.php
Merge pull request #7988 from friendica/MrPetovan-notice
[friendica.git] / bin / worker.php
index 53033312769a41992a6ce1f2794bbfeadba249f6..469dcb001e6419accd062df13597abc705cfbf2d 100755 (executable)
@@ -5,13 +5,13 @@
  * @brief Starts the background processing
  */
 
+use Dice\Dice;
 use Friendica\App;
+use Friendica\BaseObject;
 use Friendica\Core\Config;
-use Friendica\Core\Config\Cache;
 use Friendica\Core\Update;
 use Friendica\Core\Worker;
-use Friendica\Factory;
-use Friendica\Util\BasePath;
+use Psr\Log\LoggerInterface;
 
 // Get options
 $shortopts = 'sn';
@@ -32,20 +32,14 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
 
 require dirname(__DIR__) . '/vendor/autoload.php';
 
-$basedir = BasePath::create(dirname(__DIR__), $_SERVER);
-$configLoader = new Cache\ConfigCacheLoader($basedir);
-$configCache = Factory\ConfigFactory::createCache($configLoader);
-Factory\DBFactory::init($configCache, $_SERVER);
-$config = Factory\ConfigFactory::createConfig($configCache);
-// needed to call PConfig::init()
-Factory\ConfigFactory::createPConfig($configCache);
-$logger = Factory\LoggerFactory::create('worker', $config);
-$profiler = Factory\ProfilerFactory::create($logger, $config);
+$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
+$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['worker']]);
 
-$a = new App($config, $logger, $profiler);
+BaseObject::setDependencyInjection($dice);
+$a = BaseObject::getApp();
 
 // Check the database structure and possibly fixes it
-Update::check($a->getBasePath(), true);
+Update::check($a->getBasePath(), true, $a->getMode());
 
 // Quit when in maintenance
 if (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED)) {