mirror of
https://github.com/friendica/friendica
synced 2025-01-06 20:04:44 +00:00
Move code from console.php into App::processConsole()
This commit is contained in:
parent
907e07a4c4
commit
f40b428ac2
2 changed files with 16 additions and 12 deletions
|
@ -14,21 +14,11 @@ if (php_sapi_name() !== 'cli') {
|
|||
}
|
||||
|
||||
use Dice\Dice;
|
||||
use Friendica\Core\Logger\Capability\LogChannel;
|
||||
use Friendica\DI;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
$dice = (new Dice())->addRules(require(dirname(__DIR__) . '/static/dependencies.config.php'));
|
||||
|
||||
/** @var \Friendica\Core\Addon\Capability\ICanLoadAddons $addonLoader */
|
||||
$addonLoader = $dice->create(\Friendica\Core\Addon\Capability\ICanLoadAddons::class);
|
||||
$dice = $dice->addRules($addonLoader->getActiveAddonConfig('dependencies'));
|
||||
$dice = $dice->addRule(LoggerInterface::class, ['constructParams' => [LogChannel::CONSOLE]]);
|
||||
$app = \Friendica\App::fromDice($dice);
|
||||
|
||||
/// @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($dice, $_SERVER['argv'] ?? []))->execute();
|
||||
$app->processConsole($_SERVER['argv'] ?? []);
|
||||
|
|
14
src/App.php
14
src/App.php
|
@ -190,6 +190,20 @@ class App
|
|||
}
|
||||
}
|
||||
|
||||
public function processConsole(array $argv): void
|
||||
{
|
||||
/** @var \Friendica\Core\Addon\Capability\ICanLoadAddons $addonLoader */
|
||||
$addonLoader = $this->container->create(\Friendica\Core\Addon\Capability\ICanLoadAddons::class);
|
||||
$this->container = $this->container->addRules($addonLoader->getActiveAddonConfig('dependencies'));
|
||||
$this->container = $this->container->addRule(LoggerInterface::class, ['constructParams' => [LogChannel::CONSOLE]]);
|
||||
|
||||
/// @fixme Necessary until Hooks inside the Logger can get loaded without the DI-class
|
||||
DI::init($this->container);
|
||||
\Friendica\Core\Logger\Handler\ErrorHandler::register($this->container->create(\Psr\Log\LoggerInterface::class));
|
||||
|
||||
(new \Friendica\Core\Console($this->container, $argv))->execute();
|
||||
}
|
||||
|
||||
private function setupContainerForAddons(): void
|
||||
{
|
||||
/** @var \Friendica\Core\Addon\Capability\ICanLoadAddons $addonLoader */
|
||||
|
|
Loading…
Reference in a new issue