示例#1
0
<?php

$zipPath = false;
if (isset($argv[1])) {
    touch($argv[1]);
    $zipPath = realpath($argv[1]);
}
chdir(__DIR__);
$startTime = time();
require_once '../incl/incl.php';
require_once '../incl/heartbeat.incl.php';
RunMeNTimes(1);
CatchKill();
ini_set('memory_limit', '256M');
if (!DBConnect()) {
    DebugMessage('Cannot connect to db!', E_USER_ERROR);
}
$db->query('set session transaction isolation level read uncommitted');
$luaQuoteChange = ["\r" => '\\r', "\n" => '\\n', chr(26) => '\\026'];
heartbeat();
file_put_contents('../addon/GetDetailedItemLevelInfo.lua', BuildGetDetailedItemLevelInfo());
file_put_contents('../addon/BonusSets.lua', BuildBonusSets());
file_put_contents('../addon/MarketData-US.lua', BuildAddonData('US'));
file_put_contents('../addon/MarketData-EU.lua', BuildAddonData('EU'));
MakeZip($zipPath);
DebugMessage('Done! Started ' . TimeDiff($startTime));
function BuildGetDetailedItemLevelInfo()
{
    global $db;
    $lua = <<<'EOF'
--[[
示例#2
0
<?php

chdir(__DIR__);
$startTime = time();
require_once 'incl/incl.php';
require_once 'incl/heartbeat.incl.php';
require_once 'incl/battlenet.incl.php';
//ini_set('memory_limit','512M');
RunMeNTimes(3);
CatchKill();
if (!DBConnect()) {
    DebugMessage('Cannot connect to db!', E_USER_ERROR);
}
$allRealms = [];
$ownerRealms = [];
if (($realm = GetNextRealm()) === false) {
    DebugMessage('No realms to fetch right now.');
    exit;
}
DebugMessage('Working with ' . $realm['region'] . ' ' . $realm['name']);
$characterNames = GetCharacterNames($realm);
while (count($characterNames)) {
    heartbeat();
    if ($caughtKill) {
        exit;
    }
    GetNextCharacter($characterNames);
}
$characterNames = GetChallengeModeCharacters($realm);
while (count($characterNames)) {
    heartbeat();
示例#3
0
<?php

chdir(__DIR__);
$startTime = time();
require_once '../incl/incl.php';
require_once '../incl/heartbeat.incl.php';
require_once '../incl/memcache.incl.php';
RunMeNTimes(2);
CatchKill();
define('SNAPSHOT_PATH', '/var/newsstand/snapshots/parse/');
define('MAX_BONUSES', 6);
// is a count, 1 through N
define('ITEM_ID_PAD', 7);
// min number of chars for item id, for sorting infokeys
define('EXISTING_SQL', 'SELECT a.id, a.bid, a.buy, a.timeleft+0 timeleft, concat_ws(\':\', lpad(a.item,' . ITEM_ID_PAD . ',\'0\'), ifnull(ae.bonusset,0)) infokey FROM tblAuction a LEFT JOIN tblAuctionExtra ae on a.house=ae.house and a.id=ae.id WHERE a.house = ?');
define('EXISTING_COL_BID', 0);
define('EXISTING_COL_BUY', 1);
define('EXISTING_COL_TIMELEFT', 2);
define('EXISTING_COL_INFOKEY', 3);
define('DB_LOCK_SEEN_BONUSES', 'update_seen_bonuses');
define('DB_LOCK_SEEN_ILVLS', 'update_seen_ilvls');
ini_set('memory_limit', '768M');
if (!DBConnect()) {
    DebugMessage('Cannot connect to db!', E_USER_ERROR);
}
if (APIMaintenance()) {
    DebugMessage('API Maintenance in progress, not parsing snapshots!', E_USER_NOTICE);
    exit;
}
$stmt = $db->prepare('SELECT house, region FROM tblRealm GROUP BY house');
$stmt->execute();
示例#4
0
$regions = ['US', 'EU', 'CN', 'TW', 'KR'];
if (!isset($argv[1]) || !in_array($argv[1], $regions)) {
    DebugMessage('Need region ' . implode(', ', $regions), E_USER_ERROR);
}
if (!DBConnect()) {
    DebugMessage('Cannot connect to db!', E_USER_ERROR);
}
$region = $argv[1];
$runNTimes = 1;
if (isset($argv[2])) {
    $runNTimes = intval($argv[2], 10);
    if ($runNTimes <= 0) {
        $runNTimes = 1;
    }
}
RunMeNTimes($runNTimes);
CatchKill();
$loopStart = time();
$toSleep = 0;
while (!$caughtKill && time() < $loopStart + 60 * 30) {
    heartbeat();
    sleep(min($toSleep, 30));
    if ($caughtKill) {
        break;
    }
    ob_start();
    $toSleep = FetchSnapshot();
    ob_end_flush();
    if ($toSleep === false) {
        break;
    }