X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConsole.php;h=16fc90c4eb3ebbe91bca2c892bc500c1ac9a928e;hb=0dbce6e58ba6494daf1ad30812cdffd5a779eda4;hp=2893c27b2341e2275b3f2055d84b7e3e4a8b9052;hpb=cd41efe29de0aa712619faf7a07e209003639250;p=friendica.git diff --git a/src/Core/Console.php b/src/Core/Console.php index 2893c27b23..16fc90c4eb 100644 --- a/src/Core/Console.php +++ b/src/Core/Console.php @@ -2,6 +2,7 @@ namespace Friendica\Core; +use Dice\Dice; use Friendica; /** @@ -15,6 +16,11 @@ class Console extends \Asika\SimpleConsole\Console protected $helpOptions = []; protected $customHelpOptions = ['h', 'help', '?']; + /** + * @var Dice The DI library + */ + protected $dice; + protected function getHelp() { $help = << Friendica\Console\GlobalCommunitySilence::class, 'archivecontact' => Friendica\Console\ArchiveContact::class, 'autoinstall' => Friendica\Console\AutomaticInstallation::class, + 'lock' => Friendica\Console\Lock::class, 'maintenance' => Friendica\Console\Maintenance::class, 'newpassword' => Friendica\Console\NewPassword::class, 'php2po' => Friendica\Console\PhpToPo::class, @@ -69,6 +77,19 @@ HELP; 'storage' => Friendica\Console\Storage::class, ]; + /** + * CliInput Friendica constructor. + * + * @param Dice $dice The DI library + * @param array $argv + */ + public function __construct(Dice $dice, array $argv = null) + { + parent::__construct($argv); + + $this->dice = $dice; + } + protected function doExecute() { if ($this->getOption('v')) { @@ -125,8 +146,10 @@ HELP; $className = $this->subConsoles[$command]; + Friendica\DI::init($this->dice); + /** @var Console $subconsole */ - $subconsole = new $className($subargs); + $subconsole = $this->dice->create($className, [$subargs]); foreach ($this->options as $name => $value) { $subconsole->setOption($name, $value);