if ($fp && fwrite($fp, $data) && fclose($fp)) { $url_params = $url['path'] . '/api.php?act=data_get_confirm&type=' . $type . '&key=' . $url['key'] . '&file=' . $f; file_get_contents($url_params); } } } } } foreach ($tracklist as $n => $track) { if ($n == 0) { continue; } // не трогаем первый трекер, это мастер // Remote tracker if (substr($track['path'], 0, 4) == 'http') { $files = api_get_files($track, $n); // Local tracker } else { foreach (array('clicks', 'postback') as $type) { $files = dir_files($track['path'] . '/cache/' . $type, $type); foreach ($files as $f) { rename($track['path'] . '/cache/' . $type . '/' . $f, _CACHE_PATH . '/' . $type . '/' . $f . '_' . $n); } } } } // Process clicks $arr_files = array(); $process_at_once = 60 * 24 * 10; $iCnt = 0; if ($handle = opendir(_CACHE_PATH . '/clicks/')) {
function download_clicks() { global $tracklist; foreach ($tracklist as $n => $track) { if (substr($track['path'], 0, 4) == 'http') { // Remote tracker api_get_files($track, $n); } else { if ($n == 0) { continue; } // First tracker is master, don't touch // Local tracker foreach (array('clicks', 'postback') as $type) { $files = dir_files($track['path'] . '/cache/' . $type, $type); foreach ($files as $f) { rename($track['path'] . '/cache/' . $type . '/' . $f, _CACHE_PATH . '/' . $type . '/' . $f . '_' . $n); } } } } }