X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fconsole.php;h=e1bc6b498547f4e15e368ad429c489333a474bd9;hb=e02c475c9e98f27f631bd245592f1641c181db72;hp=ceccfc823edc08a0bc324e295da17d34a2459f9e;hpb=5e6e1a80250a9b03a0689bbda92a6a66140cc669;p=friendica.git diff --git a/bin/console.php b/bin/console.php index ceccfc823e..e1bc6b4985 100755 --- a/bin/console.php +++ b/bin/console.php @@ -1,19 +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); -$profiler = Factory\ProfilerFactory::create($config); +$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php'); +$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]); -$a = new Friendica\App($config, $logger, $profiler); -\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();