You are here

function feeds_batch in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 feeds.module \feeds_batch()
  2. 6 feeds.module \feeds_batch()
  3. 7 feeds.module \feeds_batch()

Batch API worker callback. Used by FeedsSource::startBatchAPIJob().

@todo Harmonize Job Scheduler API callbacks with Batch API callbacks?

Parameters

string $method: Method to execute on importer; one of 'import' or 'clear'.

string $importer_id: Identifier of a FeedsImporter object.

int $feed_nid: If importer is attached to content type, feed node id identifying the source to be imported.

array $context: Batch context.

See also

FeedsSource::startBatchAPIJob()

Related topics

3 string references to 'feeds_batch'
drush_feeds_clear in ./feeds.drush.inc
Clears a Feeds importer.
FeedsSource::startBatchAPIJob in includes/FeedsSource.inc
Batch API helper. Starts a Batch API job.
_drush_feeds_create_import_batch in ./feeds.drush.inc
Creates a batch job for an import.

File

./feeds.module, line 272
Feeds - basic API functions and hook implementations.

Code

function feeds_batch($method, $importer_id, $feed_nid = 0, &$context) {
  $context['finished'] = FEEDS_BATCH_COMPLETE;
  try {
    $context['finished'] = feeds_source($importer_id, $feed_nid)
      ->{$method}();
  } catch (Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
  }
}