Ejemplo n.º 1
0
<?php

require_once '../init.php';
global $beSocial;
if ($beSocial != true) {
    $redis->del("queueSocial");
    exit;
}
$queueSocial = new RedisQueue('queueSocial');
$timer = new Timer();
while ($timer->stop() < 59000) {
    $killID = $queueSocial->pop();
    if ($killID != null) {
        beSocial($killID);
    }
}
function beSocial($killID)
{
    global $beSocial, $mdb;
    if (!isset($beSocial)) {
        $beSocial = false;
    }
    if ($beSocial === false) {
        return;
    }
    if ($killID < 0) {
        return;
    }
    $ircMin = 10000000000.0;
    $twitMin = 10000000000.0;
    $kill = $mdb->findDoc('killmails', ['killID' => $killID]);
Ejemplo n.º 2
0
<?php

require_once '../init.php';
global $redisQServer;
if ($redisQServer == null) {
    exit;
}
$queueRedisQ = new RedisQueue('queueRedisQ');
$timer = new Timer();
while ($timer->stop() <= 59000) {
    $killID = $queueRedisQ->pop();
    if ($killID == null) {
        continue;
    }
    $rawmail = $mdb->findDoc('rawmails', ['killID' => $killID]);
    $zkb = $mdb->findField('killmails', 'zkb', ['killID' => $killID]);
    $zkb['href'] = "https://public-crest.eveonline.com/killmails/{$killID}/" . $zkb['hash'] . '/';
    unset($rawmail['_id']);
    $package = ['killID' => $killID, 'killmail' => $rawmail, 'zkb' => $zkb];
    RedisQ\Action::queue($redisQServer, $redisQAuthUser, $redisQAuthPass, $package);
}
Ejemplo n.º 3
0
require_once '../init.php';
if ($redis->get("tq:itemsPopulated") != true) {
    Util::out("Waiting for all items to be populated...");
    exit;
}
$timer = new Timer();
$crestmails = $mdb->getCollection('crestmails');
$killmails = $mdb->getCollection('killmails');
$queueInfo = new RedisQueue('queueInfo');
$queueProcess = new RedisQueue('queueProcess');
$storage = $mdb->getCollection('storage');
$counter = 0;
$timer = new Timer();
while ($timer->stop() < 59000) {
    $killID = $queueProcess->pop();
    if ($killID !== null) {
        $raw = $mdb->findDoc('rawmails', ['killID' => $killID]);
        $mail = $raw;
        $kill = array();
        $kill['killID'] = $killID;
        $crestmail = $crestmails->findOne(['killID' => $killID, 'processed' => true]);
        if ($crestmail == null) {
            continue;
        }
        $date = substr($mail['killTime'], 0, 10);
        $date = str_replace('.', '-', $date);
        $today = date('Y-m-d');
        $kill['dttm'] = new MongoDate(strtotime(str_replace('.', '-', $mail['killTime']) . ' UTC'));
        $system = $mdb->findDoc('information', ['type' => 'solarSystemID', 'id' => (int) $mail['solarSystem']['id']]);
        if ($system == null) {
Ejemplo n.º 4
0
<?php

require_once '../init.php';
// Send the mails to eve-kill cuz we're nice like that
$queueShare = new RedisQueue('queueShare');
do {
    $killID = $queueShare->pop();
    if ($killID == null) {
        continue;
    }
    $hash = $mdb->findField('crestmails', 'hash', ['killID' => $killID, 'processed' => true]);
    Util::getData("https://beta.eve-kill.net/crestmail/{$killID}/{$hash}/", 0);
} while ($killID != null);
Ejemplo n.º 5
0
<?php

require_once '../init.php';
$queueInfo = new RedisQueue('queueInfo');
$queueSocial = new RedisQueue('queueSocial');
$queueStats = new RedisQueue('queueStats');
$killmails = $mdb->getCollection('killmails');
$rawmails = $mdb->getCollection('rawmails');
$information = $mdb->getCollection('information');
$statArray = ['characterID', 'corporationID', 'allianceID', 'factionID', 'shipTypeID', 'groupID'];
while (!Util::exitNow()) {
    $killID = $queueInfo->pop();
    if ($killID !== null) {
        updateInfo($killID);
        updateStatsQueue($killID);
        $queueSocial->push($killID);
    }
}
function updateStatsQueue($killID)
{
    global $killmails, $statArray, $queueStats;
    $kill = $killmails->findOne(['killID' => $killID]);
    $involved = $kill['involved'];
    $sequence = $kill['sequence'];
    // solar system
    addToStatsQueue('solarSystemID', $kill['system']['solarSystemID'], $sequence);
    addToStatsQueue('regionID', $kill['system']['regionID'], $sequence);
    foreach ($involved as $inv) {
        foreach ($statArray as $stat) {
            if (isset($inv[$stat])) {
                addToStatsQueue($stat, $inv[$stat], $sequence);
Ejemplo n.º 6
0
            continue;
        }
        if ($currentSum == $allTimeSum) {
            continue;
        }
        if ($currentSum - $allTimeSum < $allTimeSum * 0.01) {
            continue;
        }
        $queueTopAlltime->push($row['_id']);
    }
}
$redis->setex($redisKey, 86400, true);
if ($redis->llen('queueStats') > 100) {
    exit;
}
while ($id = $queueTopAlltime->pop()) {
    $row = $mdb->findDoc('statistics', ['_id' => $id]);
    calcTop($row);
    if ($redis->llen('queueStats') > 100) {
        exit;
    }
}
function calcTop($row)
{
    global $mdb;
    $timer = new Timer();
    $currentSum = (int) @$row['shipsDestroyed'];
    $parameters = [$row['type'] => $row['id']];
    $parameters['limit'] = 10;
    $parameters['kills'] = true;
    $topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
Ejemplo n.º 7
0
<?php

require_once '../init.php';
$agents = [];
$qServer = new RedisQueue('queueServer');
$timer = new Timer();
while ($timer->stop() <= 59000) {
    $row = $qServer->pop();
    if ($row === null) {
        exit;
    }
    $agent = strtolower(@$row['HTTP_USER_AGENT']);
    if (!isBot($agent)) {
        if (isset($row['REQUEST_URI'])) {
            $uri = $row['REQUEST_URI'];
            $key = "cache:{$uri}";
            if (Util::startsWith($uri, '/kill/') || $uri == '/') {
                if (!$redis->exists($key)) {
                    $contents = @file_get_contents("http://zkillboard.com{$uri}");
                    if ($contents != '') {
                        $redis->setex($key, 300, $contents);
                    }
                }
            }
        }
    }
}
function isBot($agent)
{
    if (strpos($agent, 'chrome') !== false) {
        return false;
Ejemplo n.º 8
0
<?php

require_once '../init.php';
$timer = new Timer();
$children = [];
$inProgress = [];
$maxChildren = 10;
$maxTime = 295000;
$queueStats = new RedisQueue('queueStats');
do {
    if ($redis->llen("queueServer") > 100) {
        exit;
    }
    $row = $queueStats->pop();
    if ($row !== null) {
        $id = $row['id'];
        $type = $row['type'];
        calcStats($row);
    }
} while ($timer->stop() <= $maxTime);
$status = 0;
function calcStats($row)
{
    global $mdb, $debug;
    $type = $row['type'];
    $id = $row['id'];
    $newSequence = $row['sequence'];
    $key = ['type' => $type, 'id' => $id];
    $stats = $mdb->findDoc('statistics', $key);
    if ($stats === null) {
        $stats = [];