X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=bin%2Fconsole.php;h=0684f240e2113b8fe782f69f4ff536faeaf049e7;hb=8357a70c4bc7a104373be2ddde6e8d918ea5721b;hp=2b0d5882108187143bff764c4ff0b12cc6d47cd7;hpb=80f1feabe5ecf9b09b76627ba4b114ae10ddcaf6;p=friendica.git diff --git a/bin/console.php b/bin/console.php index 2b0d588210..0684f240e2 100755 --- a/bin/console.php +++ b/bin/console.php @@ -1,23 +1,36 @@ #!/usr/bin/env php . + * + */ -require dirname(__DIR__) . '/vendor/autoload.php'; +if (php_sapi_name() !== 'cli') { + header($_SERVER["SERVER_PROTOCOL"] . ' 403 Forbidden'); + exit(); +} -use Friendica\Core\Config\Cache; -use Friendica\Factory; -use Friendica\Util\BasePath; +use Dice\Dice; +use Psr\Log\LoggerInterface; -$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); +require dirname(__DIR__) . '/vendor/autoload.php'; -$a = new Friendica\App($config, $logger, $profiler); -\Friendica\BaseObject::setApp($a); +$dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config.php'); +$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['console']]); -(new Friendica\Core\Console($argv))->execute(); +(new Friendica\Core\Console($dice, $argv))->execute();