Skip to content
Snippets Groups Projects
Commit a8468ac9 authored by klausi's avatar klausi Committed by Chris Leppanen
Browse files

Issue #2192819 by twistor, klausi: FeedsHTTPFetcherResult should store the result between batches.

parent 83f1a1d4
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,19 @@ feeds_include_library('PuSHSubscriber.inc', 'PuSHSubscriber');
* Result of FeedsHTTPFetcher::fetch().
*/
class FeedsHTTPFetcherResult extends FeedsFetcherResult {
/**
* The URL of the feed being fetched.
*
* @var string
*/
protected $url;
protected $file_path;
/**
* The timeout in seconds to wait for a download.
*
* @var int
*/
protected $timeout;
/**
......@@ -20,19 +31,22 @@ class FeedsHTTPFetcherResult extends FeedsFetcherResult {
*/
public function __construct($url = NULL) {
$this->url = $url;
parent::__construct('');
}
/**
* Overrides FeedsFetcherResult::getRaw();
*/
public function getRaw() {
feeds_include_library('http_request.inc', 'http_request');
$result = http_request_get($this->url, NULL, NULL, NULL, $this->timeout);
if (!in_array($result->code, array(200, 201, 202, 203, 204, 205, 206))) {
throw new Exception(t('Download of @url failed with code !code.', array('@url' => $this->url, '!code' => $result->code)));
if (!isset($this->raw)) {
feeds_include_library('http_request.inc', 'http_request');
$result = http_request_get($this->url, NULL, NULL, NULL, $this->timeout);
if (!in_array($result->code, array(200, 201, 202, 203, 204, 205, 206))) {
throw new Exception(t('Download of @url failed with code !code.', array('@url' => $this->url, '!code' => $result->code)));
}
$this->raw = $result->data;
}
return $this->sanitizeRaw($result->data);
return $this->sanitizeRaw($this->raw);
}
public function getTimeout() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment