예제 #1
0
<?php

require_once '../init.php';
$minute = (int) date('i');
$hour = (int) date('H');
if ($hour != 4) {
    exit;
}
if ($minute != 0) {
    exit;
}
$mdb = new Mdb();
$types = ['characterID', 'corporationID', 'allianceID', 'factionID', 'groupID', 'shipTypeID', 'solarSystemID', 'regionID'];
$timer = new Timer();
$ninetyDayKillID = MongoFilter::getKillIDFromTime(time() - 90 * 86400);
$date = new MongoDate(strtotime(date('Y-m-d')));
// Clear out ranks more than two weeks old
$mdb->remove('ranksProgress', ['date' => ['$lt' => $mdb->now(-86400 * 14)]]);
foreach ($types as $type) {
    Util::out("Started recent calcs for {$type}");
    $calcStats = $mdb->find('information', ['type' => $type]);
    foreach ($calcStats as $row) {
        calcStats($row, $ninetyDayKillID);
    }
    Util::out("Completed recent calcs for {$type}");
}
function calcStats($row, $ninetyDayKillID)
{
    global $mdb, $debug;
    $type = $row['type'];
    $id = $row['id'];