* 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';
require dirname(__DIR__) . '/vendor/autoload.php';
-$a = Factory\DependencyFactory::setUp('daemon', dirname(__DIR__));
+$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
+$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']]);
-if ($a->getMode()->isInstall()) {
+DI::init($dice);
+$a = DI::app();
+
+if (DI::mode()->isInstall()) {
die("Friendica isn't properly installed yet.\n");
}
file_put_contents($pidfile, $pid);
// We lose the database connection upon forking
- $a->getDatabase()->reconnect();
+ DBA::reconnect();
}
Config::set('system', 'worker_daemon_mode', true);