X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fconsole.php;h=e1bc6b498547f4e15e368ad429c489333a474bd9;hb=010d7fb723f703df28b2cdebeb870387ef30217c;hp=d783e1159f7a273a1e6e350537ae2cbc83c022bc;hpb=fe8f0e00454919e3ee1150a2e75badb55a273c3a;p=friendica.git diff --git a/bin/console.php b/bin/console.php index d783e1159f..e1bc6b4985 100755 --- a/bin/console.php +++ b/bin/console.php @@ -1,13 +1,41 @@ #!/usr/bin/env php . + * + */ -require dirname(__DIR__) . '/vendor/autoload.php'; +if (php_sapi_name() !== 'cli') { + header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden'); + exit(); +} + +use Dice\Dice; +use Friendica\DI; +use Psr\Log\LoggerInterface; -use Friendica\Core\Logger; +require dirname(__DIR__) . '/vendor/autoload.php'; -$logger = Logger::create('console'); +$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php'); +$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]); -$a = new Friendica\App(dirname(__DIR__), $logger); -\Friendica\BaseObject::setApp($a); +/// @fixme Necessary until Hooks inside the Logger can get loaded without the DI-class +DI::init($dice); +\Friendica\Core\Logger\Handler\ErrorHandler::register($dice->create(\Psr\Log\LoggerInterface::class)); -(new Friendica\Core\Console($argv))->execute(); +(new Friendica\Core\Console($dice, $argv))->execute();