+
+use Dice\Dice;
+use Friendica\Core\Logger;
+use Friendica\Core\Worker;
+use Friendica\Database\DBA;
+use Friendica\DI;
+use Psr\Log\LoggerInterface;
+
+// Get options
+$shortopts = 'f';
+$longopts = ['foreground'];
+$options = getopt($shortopts, $longopts);
+
+// Ensure that daemon.php is executed from the base path of the installation
+if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
+ $directory = dirname($_SERVER["argv"][0]);
+
+ if (substr($directory, 0, 1) != "/") {
+ $directory = $_SERVER["PWD"] . "/" . $directory;
+ }
+ $directory = realpath($directory . "/..");
+
+ chdir($directory);
+}
+
+require dirname(__DIR__) . '/vendor/autoload.php';
+
+$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php');
+$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']]);
+
+DI::init($dice);
+$a = DI::app();
+
+if (DI::mode()->isInstall()) {
+ die("Friendica isn't properly installed yet.\n");