<?php require_once '../init.php'; $minute = (int) date('i'); if ($minute != 0) { exit; } $mdb = new Mdb(); $killsLastHour = new RedisTtlCounter('killsLastHour', 3600); $kills = $killsLastHour->count(); $count = $mdb->findField('storage', 'contents', ['locker' => 'totalKills']); if ($kills > 0) { Log::irc('|g|' . number_format($kills, 0) . '|n| kills processed.'); Util::out(number_format($kills, 0) . ' kills added, now at ' . number_format($count, 0) . ' kills.'); } $redis->set('zkb:totalKills', $mdb->count('killmails')); $redis->set('zkb:crestRemaining', Db::queryField('select count(*) count from kills_by_dttm where status = 0', 'count'));
} function mergeAllTime(&$stats, $result, $isVictim) { if (sizeof($result) == 0) { return; } $row = $result[0]; $dl = $isVictim ? 'Lost' : 'Destroyed'; @($stats["recentShips{$dl}"] += $row['killIDCount']); @($stats["recentPoints{$dl}"] += $row['zkb_pointsSum']); @($stats["recentIsk{$dl}"] += (int) $row['zkb_totalValueSum']); } $categories = ['Ships', 'Isk', 'Points']; foreach ($types as $type) { Util::out("Starting recent ranking for {$type}"); $size = $mdb->count('statistics', ['type' => $type]); $rankingIDs = []; foreach ($categories as $category) { for ($i = 0; $i <= 1; ++$i) { $field = $category . ($i == 0 ? 'Destroyed' : 'Lost'); $currentValue = -1; $currentRank = 0; $allIDs = $mdb->find('statistics', ['type' => $type], ["recent{$field}" => -1], null, ['months' => 0, 'groups' => 0]); $currentRank = 0; foreach ($allIDs as $row) { if (!isset($row["recent{$field}"])) { continue; } ++$currentRank; $mdb->getCollection('statistics')->update($row, ['$set' => ["recent{$field}Rank" => $currentRank]]); }
<?php require_once '../init.php'; $minute = (int) date('i'); if ($minute != 0) { exit; } $mdb = new Mdb(); $killsLastHour = new RedisTtlCounter('killsLastHour', 3600); $kills = $killsLastHour->count(); $count = $mdb->count("killmails"); if ($kills > 0) { Log::irc('|g|' . number_format($kills, 0) . '|n| kills processed.'); Util::out(number_format($kills, 0) . ' kills added, now at ' . number_format($count, 0) . ' kills.'); } $redis->set('zkb:totalKills', $count);