X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fconsole.php;h=41e0172489e672657e1ce56d1fcabbae36192e92;hb=d26b0ed5a2b5cd66954816096ba87c05043826f0;hp=9061824d875b0be10f8f1fad8aa94c1f883c55a0;hpb=d6a82c6c2d7befde9914fce3bd4e3e07b97ca036;p=friendica.git diff --git a/bin/console.php b/bin/console.php index 9061824d87..41e0172489 100755 --- a/bin/console.php +++ b/bin/console.php @@ -1,18 +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\Config; -use Friendica\Factory; -use Friendica\Util\BasePath; +require dirname(__DIR__) . '/vendor/autoload.php'; -$basedir = BasePath::create(dirname(__DIR__), $_SERVER); -$configLoader = new Config\ConfigCacheLoader($basedir); -$config = Factory\ConfigFactory::createCache($configLoader); -$logger = Factory\LoggerFactory::create('console', $config); +$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php'); +$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]); -$a = new Friendica\App($config, $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();