You are here

function _drush_feeds_create_import_batch in Feeds 7.2

Creates a batch job for an import.

Parameters

string $importer_id: The importer id.

int $feed_nid: The feed node id.

2 calls to _drush_feeds_create_import_batch()
drush_feeds_import in ./feeds.drush.inc
Imports a given importer/source.
drush_feeds_import_all in ./feeds.drush.inc
Imports all feeds.

File

./feeds.drush.inc, line 514
Drush commands for Feeds module.

Code

function _drush_feeds_create_import_batch($importer_id, $feed_nid) {
  $feed_node = FALSE;
  if ($feed_nid) {
    if (!($feed_node = node_load($feed_nid))) {
      drush_set_error(dt('The feed node @feed_nid (@importer_id) does not exist.', array(
        '@importer_id' => $importer_id,
        '@feed_nid' => $feed_nid,
      )));
      return FALSE;
    }
  }
  $title = $feed_node ? $feed_node->title . ' (' . $importer_id . ')' : $importer_id;
  drush_log(dt('Importing: @title', array(
    '@title' => $title,
  )), 'ok');
  $batch = array(
    'title' => '',
    'operations' => array(
      array(
        'feeds_batch',
        array(
          'import',
          $importer_id,
          $feed_nid,
        ),
      ),
    ),
    'progress_message' => '',
  );
  batch_set($batch);
}