Restore command.

@param LibBaseTemplateObject $command Command object
175473
protected function _commandRestore($command)
    {
        $entity = $this->getController()->getItem();
        $command->append(array('label' => AnTranslator::_('COM-ARTICLES-ARTICLE-REVISION-RESTORE')));
        $command->href('option=com_articles&view=revision&action=restore&id='.$entity->id)
        ->setAttribute('data-trigger', 'Submit');
    }
1097278
private function handleDelete(DeleteCommand $command)
    {
        $this->state = ORMInterface::STATE_DELETED;
        $this->dispatch('deleted', new RecordEvent($this, $command));
    }
1295064
public function command($command)
    {
        if (! $command instanceof Command) {
            $command = $this[$command];
        }

        $this['console']->add($command);
    }
1242469
protected function composerRunCommand($command)
    {
        $this->info("Run \"$command\".");

        $output = [];
        exec($command, $output, $returnStatusCode);

        if ($returnStatusCode !== 0) {
            throw RuntimeException::commandExecutionFailed($command, $returnStatusCode);
        }

        $this->info("\"$command\" was successfully ran.");
    }
93216
public function addCommand($command, $config = array())
    {
        if (!($command instanceof LibBaseTemplateObjectInterface)) {
            $command = $this->getCommand($command, $config);
        }

        $this->_commands[$command->getName()] = $command;

        return $this;
    }
606272
private function wrapCommandWithMessageEnvelope($command)
    {
        if ($command instanceof Command) {
            return $command;
        }

        if ($command instanceof Serializable) {
            return new GenericCommand(MessageIdentifier::generate(), $command);
        }

        throw new \InvalidArgumentException('Unsupported data type.');
    }
812061
static function clear_running_commands($command = null)
    {
        if (empty($command)){
            self::$running_commands = [];
        }else
        if (array_key_exists($command, self::$running_commands)){
            unset(self::$running_commands, $command);
        }
    }
1038700
protected function registerTailCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Commands\TailCommand($app);
        });
    }
14276
protected function doSendCommand(Command $command): void
    {
        if (!$this->shouldUseGearman()) {
            $this->locator->getCommandBus()->receiveCommand($command);
            return;
        }

        $envelope = new TransportEnvelope($command, 'php');
        $channel = $this->router->forCommand($command);

        try {
            $client = $this->getClient();
            @$client->doBackground($channel, $envelope->toString(), (string)$command->get('command_id'));
            $this->validateReturnCode($client, $channel);
        } catch (\GearmanException $ge) {
            if (isset(self::$reconnectCodes[$ge->getCode()])) {
                $this->destroyClient();
                $this->locator->getCommandBus()->receiveCommand($command);
                return;
            }

            throw $ge;
        } catch (\Throwable $e) {
            throw $e;
        }
    }
742833
public function publish(Command $command)
    {
        $index = array_search($command, $this->commands);

        // remove exists command and publish it again
        if ($index !== false) {
            unset($this->commands[$index]);
        }

        $this->commands[] = $command;

        return true;
    }
1293239
public function setCommand($command)
    {
        if (!preg_match(self::$_regex['command'], $command)) {
            throw new \InvalidArgumentException(sprintf('Command "%s" is incorect', $command));
        }

        $this->command = $command;

        return $this->generateHash();
    }
1310430
public function fireInstallingCommand(Command $command)
    {
        $this->handleMainCommand($command);

        event(new SystemWasInstalledEvent());

        $command->info('System was installed!');
    }
1259719
public function removeCommandCallback($command, $method)
    {
        $command = strtolower($command);

        if (isset($this->__command_callbacks[$command]) )
        {
            if($method instanceof \Closure) {
                $index = spl_object_hash($method);
            } else {
                $index = $method;
            }

            unset($this->__command_callbacks[$command][$index]);
        }

        return $this;
    }
344811
public static function notFound(Command $command)
    {
        $parts = explode('\\', get_class($command));

        return new self(sprintf('Not found handler for command "%s".', end($parts)));
    }
346693
protected function registerDatabaseUpgradeCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Database\Commands\DatabaseUpgradeCommand($app);
        });
    }
975662
public function fireResettingCommand(Command $command)
    {
        $this->handleMainCommand($command);

        event(new SystemWasResetEvent());

        $command->info('System was reset!');
    }
971524
protected function fixCommandDefinition(BaseCommand $command)
    {
        $definition = $command->getDefinition();

        if (!$definition->hasOption('verbose')) {
            $definition->addOption(
                new InputOption(
                    'verbose',
                    'v|vv|vvv',
                    InputOption::VALUE_NONE,
                    'Shows more details including new commits pulled in when updating packages.'
                )
            );
        }
        if (!$definition->hasOption('profile')) {
            $definition->addOption(
                new InputOption(
                    'profile',
                    null,
                    InputOption::VALUE_NONE,
                    'Display timing and memory usage information'
                )
            );
        }
        if (!$definition->hasOption('no-plugins')) {
            $definition->addOption(
                new InputOption(
                    'no-plugins',
                    null,
                    InputOption::VALUE_NONE,
                    'Whether to disable plugins.'
                )
            );
        }
        if (!$definition->hasOption('working-dir')) {
            $definition->addOption(
                new InputOption(
                    'working-dir',
                    '-d',
                    InputOption::VALUE_REQUIRED,
                    'If specified, use the given directory as working directory.'
                )
            );
        }
    }