public static function cleanup($message = 'Clean shutdown!') { GWF_CachedCounter::persist(); if (NULL !== Dog_Init::getStartupTime()) { GWF_Counter::increaseCount('dog_uptime', Dog_Init::getUptime()); } if (self::$CLEANED === false) { self::$CLEANED = true; foreach (Dog::getServers() as $server) { $server instanceof Dog_Server; if ($server->isConnected()) { $server->disconnect($message); } } } die(0); }
private function onVote($vote) { $id = (int) $this->argv(0); if (false === ($quote = Dog_Quote::getByID($id))) { return sprintf('Quote with ID(%d) not found.', $id); } if (false === $quote->increase('quot_rating', $vote)) { return 'Database Error.'; } GWF_Counter::increaseCount('dog_quotevotes', 1); return 'Vote registered.'; }
private function onVote($by) { if ('' === ($message = $this->msgarg())) { $a = $by > 0 ? '++' : '--'; $this->showHelp('link' . $a); } elseif (false === ($link = Dog_Link::getByID($message))) { $this->rply('err_link_id', array(intval($message))); } elseif (!$link->increase('link_rating', $by)) { Dog::err('ERR_DATABASE', array(__FILE__, __LINE__)); } elseif (!GWF_Counter::increaseCount('dog_linkvotes', 1)) { Dog::err('ERR_DATABASE', array(__FILE__, __LINE__)); } else { $this->rply('voted'); } }
public function deliver($from, $to, $title, $message, $parent1 = 0, $parent2 = 0) { require_once 'GWF_PM.php'; $pm1 = GWF_PM::fakePM($from, $to, $title, $message, $from, GWF_PM::OUTBOX, $parent1); $pm1->setOption(GWF_PM::READ, true); if (false === $pm1->insert()) { return -1; } $pm2 = GWF_PM::fakePM($from, $to, $title, $message, $to, GWF_PM::INBOX, $parent2, $pm1->getID()); $pm2->setOption(GWF_PM::OTHER_READ, true); if (false === $pm2->insert()) { return -2; } if (false === $pm1->saveVar('pm_otherid', $pm2->getID())) { return -3; } if (false === GWF_Counter::increaseCount('gwf3_pms_sent', 1)) { return -4; } if (!$this->cfgEmailOnPM()) { return 0; } $this->includeClass('GWF_EMailOnPM'); return GWF_EMailOnPM::deliver($this, $pm2); }