N98\Magento\Command\System\Cron\HistoryCommand::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->detectMagento($output, true);
        if ($input->getOption('format') === null) {
            $this->writeSection($output, 'Last executed jobs');
        }
        $this->initMagento();
        $timezone = $input->getOption('timezone') ? $input->getOption('timezone') : \Mage::app()->getStore()->getConfig('general/locale/timezone');
        $output->writeln('<info>Times shown in <comment>' . $timezone . '</comment></info>');
        $date = \Mage::getSingleton('core/date');
        $offset = $date->calculateOffset($timezone);
        $collection = \Mage::getModel('cron/schedule')->getCollection();
        $collection->addFieldToFilter('status', array('neq' => \Mage_Cron_Model_Schedule::STATUS_PENDING))->addOrder('finished_at', \Varien_Data_Collection_Db::SORT_ORDER_DESC);
        $table = array();
        foreach ($collection as $job) {
            $table[] = array($job->getJobCode(), $job->getStatus(), $job->getFinishedAt() ? $date->gmtDate(null, $date->timestamp($job->getFinishedAt()) + $offset) : '');
        }
        $this->getHelper('table')->setHeaders(array('Job', 'Status', 'Finished'))->renderByFormat($output, $table, $input->getOption('format'));
    }
HistoryCommand