Exemple #1
0
function main($server_cfg)
{
    $options = get_options();
    if (isset($options['g']) && $options['g'] !== '') {
        $game_names = explode(",", $options['g']);
    } else {
        $game_names = $server_cfg['game_list'];
    }
    foreach ($game_names as $game) {
        zpm_preamble($game);
        $game_cfg = load_game_config($game);
        $retval = null;
        // refs will start failing in 5.3.x if not declared
        $cleanup = "/usr/local/zperfmon/bin/clean.sh -g " . $game_cfg['name'] . " > /dev/null ";
        $output = system($cleanup, $retval);
        if ($retval != 0) {
            error_log("Couldn`t cleanup game {$game}", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            continue;
        }
        $arrays_to_id = get_array_id_map($server_cfg, $game_cfg);
        foreach ($arrays_to_id as $array => $id) {
            $game_cfg = load_game_config($game, $id);
            $cleanup = "/usr/local/zperfmon/bin/clean.sh -g " . $game_cfg['name'] . " > /dev/null ";
            $output = system($cleanup, $retval);
            if ($retval != 0) {
                error_log("Couldn`t cleanup game {$game}", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
                continue;
            }
        }
        zpm_postamble($game);
    }
}
Exemple #2
0
function insert_event($xhProfModelObject, $server_cfg = null, $game_cfg = null, $timestamp, $type, $text)
{
    if (!$xhProfModelObject) {
        return false;
    }
    $query_name = "event_insert";
    $result = null;
    $result = $xhProfModelObject->generic_execute_get_query($query_name, array('start' => $timestamp, 'type' => $type, 'text' => $text), false, false);
    //if its a array, just return, else if its a game ,fill the array dbs as well
    if (isset($game_cfg['parent'])) {
        //its an array, so our work here is done, return
        return $result;
    }
    $result_array = null;
    $arrays = get_array_id_map($server_cfg, $game_cfg);
    //for loop to put events in each array db
    foreach ($arrays as $array => $array_id) {
        $game_array_cfg = load_game_config($game_cfg['name'], $array_id);
        $xhProfModelObject = new XhProfModel($server_cfg, $game_array_cfg, false);
        $result_array = $xhProfModelObject->generic_execute_get_query($query_name, array('start' => $timestamp, 'type' => $type, 'text' => $text), false, false);
    }
    return $result;
}