function run() { require_once 'includes/classes/class.statbuilder.php'; $stat = new Statbuilder(); $result = $stat->MakeStats(); Config::update(array('stat_last_update' => TIMESTAMP)); }
function run() { require_once ROOT_PATH . 'includes/classes/class.statbuilder.php'; $stat = new Statbuilder(); $result = $stat->MakeStats(); Config::update(array('stat_last_update' => TIMESTAMP)); $Data = $GLOBALS['DATABASE']->query("SELECT id_owner, universe, tech_points, build_points, defs_points, fleet_points, popu_points, total_points, total_rank FROM " . STATPOINTS . " WHERE stat_type = 1;"); $InsertData = array(); while ($i = $GLOBALS['DATABASE']->fetch_array($Data)) { $InsertData[] = "('" . $i['id_owner'] . "','" . TIMESTAMP . "','" . $i['universe'] . "','" . $i['build_points'] . "','" . $i['tech_points'] . "','" . $i['defs_points'] . "','" . $i['fleet_points'] . "','" . $i['popu_points'] . "','" . $i['total_points'] . "','" . $i['total_rank'] . "')"; } $InsertSQL = "TRUNCATE " . STATHISTORY . ";INSERT INTO " . STATHISTORY . " (`id_owner` ,`time` ,`universe` ,`history_build_points` ,`history_tech_points` ,`history_defs_points` ,`history_fleet_points`, `history_popu_points` , `history_total_points`, `history_total_rank`) VALUES " . implode(',', $InsertData) . ";"; $GLOBALS['DATABASE']->multi_query($InsertSQL); }
include ROOT_PATH . 'common.' . PHP_EXT; if (empty($_SESSION)) { exit; } // Output transparent gif header('Cache-Control: no-cache'); header('Content-type: image/gif'); header('Content-length: 43'); header('Expires: 0'); $cron = request_var('cron', ''); switch ($cron) { case "stats": if (TIMESTAMP >= $CONF['stat_last_update'] + 60 * $CONF['stat_update_time']) { update_config('stat_last_update', TIMESTAMP); require_once ROOT_PATH . 'includes/classes/class.statbuilder.php'; $stat = new Statbuilder(); $result = $stat->MakeStats(); } break; case "opdb": if (TIMESTAMP >= $CONF['stat_last_db_update'] + 60 * 60 * 24) { update_config('stat_last_db_update', TIMESTAMP); $prueba = $db->query("SHOW TABLE STATUS from " . DB_NAME . ";"); $table = ""; while ($pru = $db->fetch_array($prueba)) { $compprefix = explode("_", $pru["Name"]); if ($compprefix[0] . "_" == DB_PREFIX) { $table .= "`" . $pru["Name"] . "`, "; } } $db->query("OPTIMIZE TABLE " . substr($table, 0, -2) . ";");
function run() { require 'includes/classes/class.statbuilder.php'; $stat = new Statbuilder(); $stat->MakeStats(); }