/** * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * * @throws \InvalidArgumentException * @return int|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')); }