/** * execute command * * @param InputInterface $input * @param OutputInterface $output */ public function execute(InputInterface $input, OutputInterface $output) { $options['unlimited'] = true; $options['list_for'] = 'admin'; $ModulesDb = new \System\Core\Models\ModulesDb($this->Db); $module_list = $ModulesDb->listModulesQb($options); unset($ModulesDb, $options); if (is_array($module_list) && array_key_exists('total', $module_list) && $module_list['total'] > '0' && array_key_exists('items', $module_list)) { $output->writeln('There are total ' . $module_list['total'] . ' modules in db.'); $output->writeln('------------------------------'); foreach ($module_list['items'] as $row) { $output->write('ID: "' . $row->module_id . '"'); $output->write(' Module: "' . $row->module_system_name . '"'); $output->writeln(' Version: "' . $row->module_version . '"'); // module in each sites. if (property_exists($row, 'module_sites')) { $Table = new \Symfony\Component\Console\Helper\Table($output); $Table->setHeaders(['Site ID', 'Enabled']); foreach ($row->module_sites as $msrow) { $Table->addRows([[$msrow->site_id, $msrow->module_enable == '1' ? 'Yes' : 'No']]); } // endforeach; unset($msrow); $Table->render(); unset($Table); $output->writeln('------------------------------'); } } // endforeach; unset($row); } else { $output->writeln('<error>Unable to list module or there is no module.</error>'); } unset($module_list); }
/** * execute command * * @param InputInterface $input * @param OutputInterface $output */ public function execute(InputInterface $input, OutputInterface $output) { $options['unlimited'] = true; $options['list_for'] = 'admin'; $ThemesDb = new \System\Core\Models\ThemesDb($this->Db); $theme_list = $ThemesDb->listThemes($options); unset($ThemesDb, $options); if (is_array($theme_list) && array_key_exists('total', $theme_list) && $theme_list['total'] > '0' && array_key_exists('items', $theme_list)) { $output->writeln('There are total ' . $theme_list['total'] . ' themes in db.'); $output->writeln('------------------------------'); foreach ($theme_list['items'] as $row) { $output->write('ID: "' . $row->theme_id . '"'); $output->write(' Theme: "' . $row->theme_system_name . '"'); $output->writeln(' Version: "' . $row->theme_version . '"'); // module in each sites. if (property_exists($row, 'theme_sites')) { $Table = new \Symfony\Component\Console\Helper\Table($output); $Table->setHeaders(['Site ID', 'Enabled', 'Default front', 'Default admin', 'Settings']); foreach ($row->theme_sites as $tsrow) { if ($tsrow->theme_enable == '1') { $theme_enable = 'Yes'; } else { $theme_enable = 'No'; } if ($tsrow->theme_default == '1') { $theme_default = 'Yes'; } else { $theme_default = 'No'; } if ($tsrow->theme_default_admin == '1') { $theme_default_admin = 'Yes'; } else { $theme_default_admin = 'No'; } $Table->addRows([[$tsrow->site_id, $theme_enable, $theme_default, $theme_default_admin, $tsrow->theme_settings]]); unset($theme_default, $theme_default_admin, $theme_enable); } // endforeach; unset($tsrow); $Table->render(); unset($Table); $output->writeln('------------------------------'); } } // endforeach; unset($row); } else { $output->writeln('<error>Unable to list theme or there is no theme.</error>'); } unset($theme_list); }
if ($doSkip) { continue; } if ((int) $metrics['elements'] == 0) { continue; } $covered = round((int) $metrics['coveredelements'] / (int) $metrics['elements'] * 100, 2); if ($covered < $minCoveragePercentage) { $failedCoverageChecks[] = ['Class' => $class, 'Coverage' => $covered]; } } if (!empty($failedCoverageChecks)) { $out->writeln('<error>Following classes found to be failing coverage check</error>'); $table = new \Symfony\Component\Console\Helper\Table($out); $table->setHeaders(['Class', 'Coverage']); $table->addRows($failedCoverageChecks); $table->render(); exit(0); //will be switched to 1 when coverage is decent } else { $out->writeln('<info>Coverage Checks: OK</info>'); exit(0); } /*** helper functions **/ function help() { global $out; $helpText = <<<HELP Usage: check-coverage.php <clover-file> <min-percentage> Check coverage of files above provided min Example: php check-coverage.php clover.xml 75