protected function updateAllParallel($subscriptions) { zf_debugRuntime("before feeds parallel update"); $urls = array(); foreach ($subscriptions as $sub) { $url = ZF_URL . '/pub/index.php?q=force-refresh&id=' . $sub->source->id; $urls[] = $url; } // Request all feed items in parallel (if supported) $http = new HumbleHttpAgent(); $http->userAgentDefault = HumbleHttpAgent::UA_PHP; zf_debug('fetching all ' . sizeof($urls) . ' feeds', DBG_FEED); $http->fetchAll($urls); foreach ($urls as $url) { zf_debug('going after ' . $url, DBG_FEED); if ($url && ($response = $http->get($url, true)) && ($response['status_code'] < 300 || $response['status_code'] > 400)) { $effective_url = $response['effective_url']; /*zf_debug('response: '. $response['body'], DBG_FEED); if(DBG_FEED & ZF_DEBUG) var_dump($response);*/ } } zf_debugRuntime("End of parallel update"); }
//////////////////////////////////////////// // Loop through feed items //////////////////////////////////////////// $items = $feed->get_items(0, $max); // Request all feed items in parallel (if supported) $urls_sanitized = array(); $urls = array(); foreach ($items as $key => $item) { $permalink = htmlspecialchars_decode($item->get_permalink()); $permalink = $http->validateUrl($permalink); if ($permalink) { $urls_sanitized[] = $permalink; } $urls[$key] = $permalink; } $http->fetchAll($urls_sanitized); $http->cacheAll(); foreach ($items as $key => $item) { $extract_result = false; $permalink = $urls[$key]; $newitem = $output->createNewItem(); $newitem->setTitle(htmlspecialchars_decode($item->get_title())); if ($valid_key && isset($_GET['pubsub'])) { // used only on fivefilters.org at the moment if ($permalink !== false) { $newitem->setLink('http://fivefilters.org/content-only/redirect.php?url=' . urlencode($permalink)); } else { $newitem->setLink('http://fivefilters.org/content-only/redirect.php?url=' . urlencode($item->get_permalink())); } } else { if ($permalink !== false) {