X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fconsole.php;h=41e0172489e672657e1ce56d1fcabbae36192e92;hb=ef4f508f9b574f649164ca86f51ef5ca7c4ecb51;hp=6fa804fb98e3789f2596c68f9a543266abdd8810;hpb=55999730e0b4ad847bb891af0aa7dbfa531f998e;p=friendica.git diff --git a/bin/console.php b/bin/console.php index 6fa804fb98..41e0172489 100755 --- a/bin/console.php +++ b/bin/console.php @@ -1,14 +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\Factory; +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' => ['console']]); -$a = Factory\DependencyFactory::setUp('console', $dice); -\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();