示例#1
0
function track_error_info($error_text)
{
    if (strstr($error_text, "Could not run query")) {
        track_error($error_text);
        exit;
    }
    if (strstr($error_text, "Download data not found")) {
        track_error($error_text);
        exit;
    }
    if (strstr($error_text, "Error parameters list")) {
        track_error($error_text);
        exit;
    }
    if (strstr($error_text, "Could not connect")) {
        track_error($error_text);
        exit;
    }
    if (strstr($error_text, "Could not select db")) {
        track_error($error_text);
        exit;
    }
    if (strstr($error_text, "Could not decrement downloads")) {
        track_error($error_text);
        exit;
    }
    if (strstr($error_text, "Could not run option value query")) {
        track_error($error_text);
        exit;
    }
    if (strstr($error_text, "Could not get option value 'max_downloads'")) {
        track_error($error_text);
        exit;
    }
}
示例#2
0
 function get_out_link($id)
 {
     $link = '';
     $id = intval($id);
     if ($id <= 0) {
         return '';
     }
     $outs_path = _CACHE_PATH . "/outs";
     $out_path = "{$outs_path}/.{$id}";
     if (is_file($out_path)) {
         $link = file_get_contents($out_path);
     } else {
         track_error('Out link ' . $id . ' not found');
     }
     return $link;
 }
示例#3
0
function get_rules($rule_name)
{
    global $rds;
    $rule_hash = md5($rule_name);
    // Задействуем Redis
    if ($rds) {
        $redis_rule_key = 'cpa_' . _SELF_TRACK_KEY . '_r_' . $rule_hash;
        if ($str_rules = $rds->get($redis_rule_key)) {
            $arr_rules = unserialize($str_rules);
            return $arr_rules;
            // В противном случае (если строчка пустая),
            // значит что-то пошло не так, возвращаемся к чтению из файла
        }
    }
    $rules_path = _CACHE_PATH . "/rules";
    $rule_path = "{$rules_path}/.{$rule_hash}";
    if (is_file($rule_path)) {
        $str_rules = file_get_contents($rule_path);
        if ($rds) {
            $rds->set($redis_rule_key, $str_rules, 86400);
        }
        $arr_rules = unserialize($str_rules);
        return $arr_rules;
    } else {
        track_error('Rule ' . $rule_name . ' not found');
    }
}