]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Console.php
Add user contact data superseding to Mastodon\Account::create
[friendica.git] / src / Core / Console.php
index 2893c27b2341e2275b3f2055d84b7e3e4a8b9052..16fc90c4eb3ebbe91bca2c892bc500c1ac9a928e 100644 (file)
@@ -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 = <<<HELP
@@ -32,6 +38,7 @@ Commands:
        archivecontact         Archive a contact when you know that it isn't existing anymore
        help                   Show help about a command, e.g (bin/console help config)
        autoinstall            Starts automatic installation of friendica based on values from htconfig.php
+       lock                   Edit site locks
        maintenance            Set maintenance mode for this node
        newpassword            Set a new password for a given user
        php2po                 Generate a messages.po file from a strings.php file
@@ -59,6 +66,7 @@ HELP;
                'globalcommunitysilence' => 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);