public function pause() { $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') != 'working') { throw new Exception("Bot must be working to pause 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, pause it. $bot->pause(); Activity::log("paused the bot " . $bot->getLink() . "."); $this->forwardToUrl("/"); } catch (Exception $e) { $this->set('megaerror', $e->getMessage()); $this->setTitle("Bot Pause Job - Error"); } }