N98\Magento\Command\Database\Maintain\CheckTablesCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer | void
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
return integer | void
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
        $this->isTypeAllowed();
        $this->detectMagento($output);
        $this->dbHelper = $this->getHelper('database');
        $this->showProgress = $input->getOption('format') == null;
        if ($input->getOption('table')) {
            $resolvedTables = array($this->dbHelper->resolveTables(array('@check'), array('check' => array('tables' => $input->getOption('table')))));
            $tables = $resolvedTables[0];
        } else {
            $tables = $this->dbHelper->getTables();
        }
        $allTableStatus = $this->dbHelper->getTablesStatus();
        $tableOutput = array();
        /** @var \Symfony\Component\Console\Helper\ProgressHelper $progress */
        $progress = $this->getHelper('progress');
        if ($this->showProgress) {
            $progress->start($output, count($tables));
        }
        $methods = array('InnoDB' => 1, 'MEMORY' => 1, 'MyISAM' => 1);
        foreach ($tables as $tableName) {
            if (isset($allTableStatus[$tableName]) && isset($methods[$allTableStatus[$tableName]['Engine']])) {
                $m = '_check' . $allTableStatus[$tableName]['Engine'];
                $tableOutput = array_merge($tableOutput, $this->{$m}($tableName));
            } else {
                $tableOutput[] = array('table' => $tableName, 'operation' => 'not supported', 'type' => '', 'status' => '');
            }
            $this->progressAdvance();
        }
        if ($this->showProgress) {
            $progress->finish();
        }
        $this->getHelper('table')->setHeaders(array('Table', 'Operation', 'Type', 'Status'))->renderByFormat($this->output, $tableOutput, $this->input->getOption('format'));
    }