You are here

function feeds_action_import_feed in Feeds 7.2

Rules action callback for "feeds_import_feed" action.

Parameters

string $importer_id: ID of the importer.

object|null $feed_node: The feed node, if found. Null otherwise.

array $params: The raw parameters.

1 string reference to 'feeds_action_import_feed'
feeds_rules_action_info in ./feeds.rules.inc
Implements hook_rules_action_info().

File

./feeds.rules.inc, line 131
Rules integration.

Code

function feeds_action_import_feed($importer_id, $feed_node, array $params) {
  $source = feeds_source($importer_id, $params['feed_nid']);
  try {
    $source
      ->existing()
      ->startImport();

    // Execute batch, if there is any. Set 'progressive' to false to prevent
    // batch from triggering a drupal_goto().
    $batch =& batch_get();
    if (!empty($batch)) {
      $batch['progressive'] = FALSE;
      batch_process();
    }
  } catch (FeedsNotExistingException $e) {

    // Ignore this kind of exception.
  } catch (Exception $e) {
    $source
      ->log('import', $e
      ->getMessage(), array(), WATCHDOG_ERROR);
  }
}