You are here

class FeedsHTTPBatch in Feeds 6

Same name and namespace in other branches
  1. 7 plugins/FeedsHTTPFetcher.inc \FeedsHTTPBatch

Definition of the import batch object created on the fetching stage by FeedsHTTPFetcher.

Hierarchy

Expanded class hierarchy of FeedsHTTPBatch

File

plugins/FeedsHTTPFetcher.inc, line 14

View source
class FeedsHTTPBatch extends FeedsImportBatch {
  protected $url;
  protected $file_path;

  /**
   * Constructor.
   */
  public function __construct($url = NULL, $feed_nid) {
    $this->url = $url;
    parent::__construct('', $feed_nid);
  }

  /**
   * Implementation of FeedsImportBatch::getRaw();
   */
  public function getRaw() {
    feeds_include_library('http_request.inc', 'http_request');
    $result = http_request_get($this->url);
    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,
      )));
    }
    return $result->data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedsBatch::$progress protected property
FeedsBatch::$total protected property
FeedsBatch::getProgress public function Report progress.
FeedsBatch::getTotal public function Get the total for a stage.
FeedsBatch::setProgress public function Set progress for a stage.
FeedsBatch::setTotal public function Set the total for a stage.
FeedsHTTPBatch::$file_path protected property
FeedsHTTPBatch::$url protected property
FeedsHTTPBatch::getRaw public function Implementation of FeedsImportBatch::getRaw(); Overrides FeedsImportBatch::getRaw
FeedsHTTPBatch::__construct public function Constructor. Overrides FeedsImportBatch::__construct
FeedsImportBatch::$created public property
FeedsImportBatch::$current_item protected property
FeedsImportBatch::$description public property
FeedsImportBatch::$feed_nid public property
FeedsImportBatch::$items public property
FeedsImportBatch::$link public property
FeedsImportBatch::$raw protected property
FeedsImportBatch::$title public property
FeedsImportBatch::$updated public property
FeedsImportBatch::addItem Deprecated public function Add an item.
FeedsImportBatch::currentItem public function
FeedsImportBatch::feedNode Deprecated public function
FeedsImportBatch::getDescription Deprecated public function
FeedsImportBatch::getFilePath public function 1
FeedsImportBatch::getItemCount Deprecated public function Get number of items.
FeedsImportBatch::getLink Deprecated public function
FeedsImportBatch::getTitle Deprecated public function
FeedsImportBatch::setDescription Deprecated public function Set description.
FeedsImportBatch::setItems Deprecated public function Set items.
FeedsImportBatch::setLink Deprecated public function Set link.
FeedsImportBatch::setTitle Deprecated public function Set title.
FeedsImportBatch::shiftItem public function @todo Move to a nextItem() based approach, not consuming the item array. Can only be done once we don't cache the entire batch object between page loads for batching anymore.