public function play() { $this->assertLoggedIn(); try { //how do we find them? if ($this->args('id')) { $bot = new Bot($this->args('id')); } else { throw new Exception("Could not find that bot."); } //did we really get someone? if (!$bot->isHydrated()) { throw new Exception("Could not find that bot."); } if (!$bot->isMine()) { throw new Exception("You cannot view that bot."); } if ($bot->get('status') != 'paused') { throw new Exception("Bot must be paused to unpause a job."); } $job = $bot->getCurrentJob(); if (!$job->isHydrated()) { throw new Exception("Job must be a real job."); } if (!$bot->canDrop($job)) { throw new Exception("Job cannot be dropped."); } //okay, unpause it. $bot->unpause(); Activity::log("unpaused the bot " . $bot->getLink() . "."); $this->forwardToUrl("/"); } catch (Exception $e) { $this->set('megaerror', $e->getMessage()); $this->setTitle("Bot Unpause Job - Error"); } }