header('Location: ?id=' . $job->getId()); exit; } echo '<pre><h1><a href="?">php-resque</a></h1><ul>' . '<li><a href="?action=reset">Reset</a></li>' . '<li><a href="?action=push">Push new job</a></li>' . '<li><a href="?action=delayed">Delayed job</a></li>' . '<li><a href="?action=delayedat">Delayed job in 2 mins</a></li>' . '<li><a href="?action=longrunning">Long running job</a></li>' . '<li><a href="?action=faillong">Fail due to running too long</a></li>' . '<li><a href="?action=failnoclass">Fail due to no class being found</a></li>' . '<li><a href="?action=failexception">Fail due to exception</a></li>' . '<li><a href="?action=failerror">Fail due to fatal error</a></li>' . '<li><a href="?action=closure">Push closure</a></li>' . '<li><a href="?action=closure-delayed">Delayed closure</a></li>' . '</ul>'; $rep = 150; echo str_repeat('=', $rep) . PHP_EOL; echo 'Resque stats: ' . json_encode(Resque::stats()) . PHP_EOL; echo 'Hosts: ' . json_encode(Resque\Redis::instance()->smembers('hosts')) . PHP_EOL; echo 'Workers: ' . json_encode(Resque\Redis::instance()->smembers('workers')) . PHP_EOL; echo 'Queues: ' . json_encode(Resque\Redis::instance()->smembers('queues')) . PHP_EOL; echo 'Default queue: ' . json_encode(Resque\Redis::instance()->hgetall('queue:default:stats')) . PHP_EOL; echo 'Time: ' . json_encode(array(time(), date('r'))) . PHP_EOL; echo str_repeat('=', $rep) . PHP_EOL; $id = isset($_GET['id']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['id']) : ''; if (!empty($id)) { if ($job = Resque::job($id)) { print_r($job->getPacket()); echo '<a href="?id=' . $id . '">Refresh</a>'; } else { echo 'Job #' . $id . ' not found'; } } list_jobs('Default queue queued jobs', Resque\Redis::instance()->lrange('queue:default', 0, -1)); foreach (array('delayed', 'running', 'processed', 'failed', 'cancelled') as $status) { list_jobs('Default queue ' . $status . ' jobs', $djobs = Resque\Redis::instance()->zrevrangebyscore('queue:default:' . $status, strtotime('+1 year'), 0)); } function list_jobs($title, $jobs) { global $rep; echo PHP_EOL . str_repeat('=', $rep) . PHP_EOL . $title . ': ' . PHP_EOL; if (count($jobs)) {