public function execute($parameters, $db) { global $enableAnalyze; $actualKills = Storage::retrieve("ActualKillCount"); $iteration = 0; while ($actualKills > 0) { $iteration++; $actualKills -= 1000000; if ($actualKills > 0 && Storage::retrieve("{$iteration}mAnnounced", null) == null) { Storage::store("{$iteration}mAnnounced", true); $message = "|g|Woohoo!|r| {$iteration} million kills surpassed!"; Log::irc($message); Log::ircAdmin($message); } } $highKillID = $db->queryField("select max(killID) highKillID from zz_killmails", "highKillID"); if ($highKillID > 2000000) { Storage::store("notRecentKillID", $highKillID - 2000000); } self::apiPercentage($db); $db->execute("delete from zz_api_log where requestTime < date_sub(now(), interval 2 hour)"); //$db->execute("update zz_killmails set kill_json = '' where processed = 2 and killID < 0 and kill_json != ''"); $db->execute("delete from zz_errors where date < date_sub(now(), interval 1 day)"); $fileCache = new FileCache(); $fileCache->cleanup(); $tableQuery = $db->query("show tables"); $tables = array(); foreach ($tableQuery as $row) { foreach ($row as $column) { $tables[] = $column; } } if ($enableAnalyze) { $tableisgood = array("OK", "Table is already up to date", "The storage engine for the table doesn't support check"); $count = 0; foreach ($tables as $table) { $count++; if (Util::isMaintenanceMode()) { continue; } $result = $db->queryRow("analyze table {$table}"); if (!in_array($result["Msg_text"], $tableisgood)) { Log::ircAdmin("|r|Error analyzing table |g|{$table}|r|: " . $result["Msg_text"]); } } } }
} $minute = date('i'); if (!in_array('-f', $argv) && $minute != 15) { return; } $p = array(); $numDays = 7; $p['limit'] = 10; $p['pastSeconds'] = $numDays * 86400; $p['kills'] = true; Storage::store('Kills5b+', json_encode(Kills::getKills(array('iskValue' => 5000000000.0), true, false))); Storage::store('Kills10b+', json_encode(Kills::getKills(array('iskValue' => 10000000000.0), true, false))); Storage::store('TopChars', json_encode(Info::doMakeCommon('Top Characters', 'characterID', getStats('pilot', 'characterID')))); Storage::store('TopCorps', json_encode(Info::doMakeCommon('Top Corporations', 'corporationID', getStats('corp', 'corporationID', false)))); Storage::store('TopAllis', json_encode(Info::doMakeCommon('Top Alliances', 'allianceID', getStats('alli', 'allianceID')))); Storage::store('TopShips', json_encode(Info::doMakeCommon('Top Ships', 'shipTypeID', getStats('ship', 'shipTypeID')))); Storage::store('TopSystems', json_encode(Info::doMakeCommon('Top Systems', 'solarSystemID', getStats('system', 'solarSystemID')))); Storage::store('TopIsk', json_encode(Stats::getTopIsk(array('pastSeconds' => $numDays * 86400, 'limit' => 5)))); Storage::store('TopPods', json_encode(Stats::getTopIsk(array('groupID' => 29, 'pastSeconds' => $numDays * 86400, 'limit' => 5)))); Storage::store('TopPoints', json_encode(Stats::getTopPoints('killID', array('losses' => true, 'pastSeconds' => $numDays * 86400, 'limit' => 5)))); // Clean up the related killmails cache $cache = new FileCache($baseDir . '/cache/related/'); $cache->cleanUp(); // Cleanup the overall file cache $fc = new FileCache(); $fc->cleanup(); function getStats($type, $column) { $result = Stats::getTop($column, ['isVictim' => false, 'pastSeconds' => 604800]); return $result; }