setName('diagnostics:archiving-queue'); $this->addNoValueOption( 'json', null, "If supplied, the command will return table data in json format" ); $this->setDescription('Show the current state of the archive invalidations queue as a table'); } protected function doExecute(): int { $input = $this->getInput(); $output = $this->getOutput(); $archiveTableDao = StaticContainer::get('Piwik\DataAccess\ArchiveTableDao'); if ($input->getOption('json')) { $queue = $archiveTableDao->getInvalidationQueueData(); $output->write(json_encode($queue)); } else { $headers = ['Invalidation', 'Segment', 'Site', 'Period', 'Date', 'Time Queued', 'Waiting', 'Started', 'Processing', 'Status']; $queue = $archiveTableDao->getInvalidationQueueData(true); $this->renderTable($headers, $queue); } return self::SUCCESS; } }