/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { parent::bootstrapProcessWire($output); // get available fieldtypes $fieldtypes = array(); foreach (\ProcessWire\wire('modules') as $module) { if (preg_match('/^Fieldtype/', $module->name)) { $fieldtypes[] = $module->name; } } WsTools::renderList('Fieldtypes', $fieldtypes, $output); }
/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { parent::bootstrapProcessWire($output); $logs = \ProcessWire\wire('log')->getLogs(); $output->writeln(WsTools::tint(count($logs) . ' logs', 'comment')); $data = array(); foreach ($logs as $log) { $data[] = array($log['name'], \ProcessWire\wireRelativeTimeStr($log['modified']), \ProcessWire\wire('log')->getTotalEntries($log['name']), \ProcessWire\wireBytesStr($log['size'])); } $headers = array('Name', 'Modified', 'Entries', 'Size'); $tables = array(WsTables::buildTable($output, $data, $headers)); WsTables::renderTables($output, $tables, false); }
/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { parent::bootstrapProcessWire($output); $log = \ProcessWire\wire('log'); $availableLogs = $log->getLogs(); $availableLogsString = implode(array_keys($availableLogs), ', '); $name = $input->getArgument('name'); if (!array_key_exists($name, $availableLogs)) { $output->writeln("<error>Log '{$name}' does not exist, choose one of `{$availableLogsString}`</error>"); return; } $output->writeln(WsTools::tint("Log {$name}", 'comment')); $options = array('limit' => $input->getOption('limit') ? $input->getOption('limit') : 10, 'dateTo' => $input->getOption('to') ? $input->getOption('to') : 'now', 'dateFrom' => $input->getOption('from') ? $input->getOption('from') : '-10years', 'text' => $input->getOption('text') ? $input->getOption('text') : ''); $headers = array('Date', 'User', 'URL', 'Message'); $data = $log->getEntries($name, $options); $tables = array(WsTables::buildTable($output, $data, $headers)); WsTables::renderTables($output, $tables, false); $count = count($data); $total = $log->getTotalEntries($name); $output->writeln(WsTools::tint("({$count} in set, total: {$total})", 'comment')); }
/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { parent::bootstrapProcessWire($output); // get available fields $fieldtypes = array(); foreach (\ProcessWire\wire('modules') as $module) { if (preg_match('/^Fieldtype/', $module->name)) { $fieldtypes[] = $module->name; } } $headers = array('Name', 'Label', 'Type', 'Templates'); $data = $this->getData($this->getFilter($input)); if (count($data->count) > 0) { foreach ($data->content as $tag => $c) { $output->writeln('<fg=yellow;options=bold> ' . strtoupper($tag) . "</>"); $tables = array(WsTables::buildTable($output, $c, $headers)); WsTables::renderTables($output, $tables, false); } } $output->writeln(WsTools::tint("({$data->count} in set)", 'comment')); }
protected function buildTable(OutputInterface $output, $statusArray, $label) { $headers = [Tools::tint($label, Tools::kTintComment)]; $tablePW = new Table($output); $tablePW->setStyle('borderless')->setHeaders($headers)->setRows($statusArray); return $tablePW; }