Resque\Commands\Cleanup::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $host = new Resque\Host();
        $cleaned_hosts = $host->cleanup();
        $worker = new Resque\Worker('*');
        $cleaned_workers = $worker->cleanup();
        $cleaned_hosts = array_merge_recursive($cleaned_hosts, $host->cleanup());
        $cleaned_jobs = Resque\Job::cleanup();
        $this->log('Cleaned hosts: <pop>' . json_encode($cleaned_hosts['hosts']) . '</pop>');
        $this->log('Cleaned workers: <pop>' . json_encode(array_merge($cleaned_hosts['workers'], $cleaned_workers)) . '</pop>');
        $this->log('Cleaned <pop>' . $cleaned_jobs['zombie'] . '</pop> zombie job' . ($cleaned_jobs['zombie'] == 1 ? '' : 's'));
        $this->log('Cleared <pop>' . $cleaned_jobs['processed'] . '</pop> processed job' . ($cleaned_jobs['processed'] == 1 ? '' : 's'));
    }