X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fconsole.php;h=35f0b5feefcf3820bfaca4739cca5eaee7e64e49;hb=214a0524ddc069f71c896eef8ccf031033125932;hp=2b0d5882108187143bff764c4ff0b12cc6d47cd7;hpb=80f1feabe5ecf9b09b76627ba4b114ae10ddcaf6;p=friendica.git diff --git a/bin/console.php b/bin/console.php index 2b0d588210..35f0b5feef 100755 --- a/bin/console.php +++ b/bin/console.php @@ -1,23 +1,38 @@ #!/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 Psr\Log\LoggerInterface; -use Friendica\Core\Config\Cache; -use Friendica\Factory; -use Friendica\Util\BasePath; +require dirname(__DIR__) . '/vendor/autoload.php'; -$basedir = BasePath::create(dirname(__DIR__), $_SERVER); -$configLoader = new Cache\ConfigCacheLoader($basedir); -$configCache = Factory\ConfigFactory::createCache($configLoader); -Factory\DBFactory::init($configCache, $_SERVER); -$config = Factory\ConfigFactory::createConfig($configCache); -// needed to call PConfig::init() -Factory\ConfigFactory::createPConfig($configCache); -$logger = Factory\LoggerFactory::create('console', $config); -$profiler = Factory\ProfilerFactory::create($logger, $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); +\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();