]> git.mxchange.org Git - friendica.git/blobdiff - bin/daemon.php
Some more added lines
[friendica.git] / bin / daemon.php
index 1b0a7edb3ca227667ad4f39fc3c5efebfdecc870..f0154e74e8dcef2242d05bd16b3619fd30f987fb 100755 (executable)
@@ -7,11 +7,13 @@
  * This script was taken from http://php.net/manual/en/function.pcntl-fork.php
  */
 
+use Dice\Dice;
 use Friendica\Core\Config;
 use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
-use Friendica\Factory;
+use Friendica\DI;
+use Psr\Log\LoggerInterface;
 
 // Get options
 $shortopts = 'f';
@@ -32,12 +34,13 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
 
 require dirname(__DIR__) . '/vendor/autoload.php';
 
-$dice = new \Dice\Dice();
-$dice = $dice->addRules(include __DIR__ . '/../static/dependencies.config.php');
+$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
+$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']]);
 
-$a = Factory\DependencyFactory::setUp('daemon', $dice);
+DI::init($dice);
+$a = DI::app();
 
-if ($a->getMode()->isInstall()) {
+if (DI::mode()->isInstall()) {
        die("Friendica isn't properly installed yet.\n");
 }
 
@@ -147,7 +150,7 @@ if (!$foreground) {
        file_put_contents($pidfile, $pid);
 
        // We lose the database connection upon forking
-       $a->getDatabase()->reconnect();
+       DBA::reconnect();
 }
 
 Config::set('system', 'worker_daemon_mode', true);