Subversion Repositories cheapmusic

Rev

Rev 83 | Rev 86 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 83 Rev 84
Line 1197... Line 1197...
1197
    }
1197
    }
1198
 
1198
 
1199
    curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
1199
    curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
1200
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
1200
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
1201
    curl_setopt($ch, CURLOPT_HEADER, 0);
1201
    curl_setopt($ch, CURLOPT_HEADER, 0);
-
 
1202
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
-
 
1203
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
1202
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1204
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1203
    curl_setopt($ch, CURLOPT_URL, $url);
1205
    curl_setopt($ch, CURLOPT_URL, $url);
1204
    $response = curl_exec($ch);
1206
    $response = curl_exec($ch);
1205
    if ($response === false) {
1207
    if ($response === false) {
1206
        error_log('Curl Request Error: ' . curl_error($ch) . ' (' . curl_errno($ch) . ')');
1208
        error_log('Curl Request Error: ' . curl_error($ch) . ' (' . curl_errno($ch) . ')');
Line 1288... Line 1290...
1288
    return $str;
1290
    return $str;
1289
}
1291
}
1290
 
1292
 
1291
// Delete left over progressbar files older than 2 days
1293
// Delete left over progressbar files older than 2 days
1292
function cleanupPbFiles() {
1294
function cleanupPbFiles() {
1293
    $files = glob("../tmp/pb*.txt");
1295
    $files = glob("../MyFiles/tmp/pb*.txt");
1294
    $now = time();
1296
    $now = time();
1295
    foreach ($files as $file) {
1297
    foreach ($files as $file) {
1296
        if (is_file($file)) {
1298
        if (is_file($file)) {
1297
            if ($now - filemtime($file) >= 60 * 60 * 24 * 2) { // 2 days and older
1299
            if ($now - filemtime($file) >= 60 * 60 * 24 * 2) { // 2 days and older
1298
                unlink($file);
1300
                unlink($file);
Line 1322... Line 1324...
1322
 
1324
 
1323
    $percent = intval($current / $max_pb * 100);
1325
    $percent = intval($current / $max_pb * 100);
1324
 
1326
 
1325
    $arr_content['percent'] = $percent;
1327
    $arr_content['percent'] = $percent;
1326
    $arr_content['message'] = $current . " search(es) processed.";
1328
    $arr_content['message'] = $current . " search(es) processed.";
1327
    $file = "../tmp/pb_" . $filename . ".txt";
1329
    $file = "../MyFiles/tmp/pb_" . $filename . ".txt";
1328
 
1330
 
1329
    if ($percent >= 100) {
1331
    if ($percent >= 100) {
1330
        @unlink($file);
1332
        @unlink($file);
1331
    } else {
1333
    } else {
1332
        file_put_contents($file, json_encode($arr_content));
1334
        file_put_contents($file, json_encode($arr_content));