diff --git a/feeds.drush.inc b/feeds.drush.inc index 484a411..0ccb19e 100644 --- a/feeds.drush.inc +++ b/feeds.drush.inc @@ -190,10 +190,10 @@ function drush_feeds_list_importers() { /** * Lists all feeds. * - * @param string $importer + * @param string $importer_id * (optional) The importer id. */ -function drush_feeds_list_feeds($importer = NULL) { +function drush_feeds_list_feeds($importer_id = NULL) { if (!$limit = drush_get_option('limit')) { $limit = 2147483647; } @@ -208,7 +208,7 @@ function drush_feeds_list_feeds($importer = NULL) { dt('Process in background'), ); - foreach (_drush_feeds_get_all($importer, $limit) as $feed) { + foreach (_drush_feeds_get_all($importer_id, $limit) as $feed) { $feed_config = feeds_source($feed->id, $feed->feed_nid)->importer->getConfig(); $rows[] = array( @@ -226,11 +226,11 @@ function drush_feeds_list_feeds($importer = NULL) { /** * Imports a given importer/source. * - * @param string $importer + * @param string $importer_id * (optional) The importer id to filter on. */ -function drush_feeds_import($importer = NULL) { - if (!strlen($importer)) { +function drush_feeds_import($importer_id = NULL) { + if (!strlen($importer_id)) { drush_set_error(dt("Please specify the importer to import items with. If the importer is attached to a content type, specify also the feed node with the option '--nid'.")); return FALSE; } @@ -240,7 +240,7 @@ function drush_feeds_import($importer = NULL) { } try { - $source = feeds_source($importer, $feed_nid)->existing(); + $source = feeds_source($importer_id, $feed_nid)->existing(); } catch (FeedsNotExistingException $e) { drush_set_error(dt('The feed @importer: @nid does not exist.', array('@importer' => $importer, '@nid' => $feed_nid))); @@ -278,15 +278,15 @@ function drush_feeds_import($importer = NULL) { /** * Imports all feeds. * - * @param string $importer + * @param string $importer_id * (optional) The importer id to filter on. */ -function drush_feeds_import_all($importer = NULL) { +function drush_feeds_import_all($importer_id = NULL) { if (!$limit = drush_get_option('limit')) { $limit = 2147483647; } - foreach (_drush_feeds_get_all($importer, $limit) as $feed) { + foreach (_drush_feeds_get_all($importer_id, $limit) as $feed) { if (!isset($feed->source) || !strlen($feed->source)) { continue; } @@ -307,28 +307,28 @@ function drush_feeds_import_all($importer = NULL) { /** * Creates a batch job for an import. * - * @param string $importer + * @param string $importer_id * The importer id. * @param int $feed_nid * The feed node id. */ -function _drush_feeds_create_import_batch($importer, $feed_nid) { +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 @importer: @nid does not exist.', array('@importer' => $importer, '@nid' => $feed_nid))); + drush_set_error(dt('The feed node @importer: @nid does not exist.', array('@importer' => $importer_id, '@nid' => $feed_nid))); return FALSE; } } - $title = $feed_node ? $feed_node->title . ' (' . $importer . ')' : $importer; + $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, $feed_nid)), + array('feeds_batch', array('import', $importer_id, $feed_nid)), ), 'progress_message' => '', ); @@ -339,11 +339,11 @@ function _drush_feeds_create_import_batch($importer, $feed_nid) { /** * Clears a Feeds importer. * - * @param string $importer + * @param string $importer_id * The importer id to clean. */ -function drush_feeds_clear($importer = NULL) { - if (!strlen($importer)) { +function drush_feeds_clear($importer_id = NULL) { + if (!strlen($importer_id)) { drush_set_error(dt("Please specify the importer to delete all imported items from. If the importer is attached to a content type, specify also the feed node with the option '--nid'.")); return FALSE; } @@ -353,7 +353,7 @@ function drush_feeds_clear($importer = NULL) { } try { - feeds_source($importer, $feed_nid)->existing(); + feeds_source($importer_id, $feed_nid)->existing(); } catch (FeedsNotExistingException $e) { drush_set_error(dt('The feed @importer: @nid does not exist.', array('@importer' => $importer, '@nid' => $feed_nid))); @@ -361,9 +361,9 @@ function drush_feeds_clear($importer = NULL) { } $batch = array( - 'title' => dt('Clearing !importer', array('!importer' => $importer)), + 'title' => dt('Clearing !importer', array('!importer' => $importer_id)), 'operations' => array( - array('feeds_batch', array('clear', $importer, $feed_nid)), + array('feeds_batch', array('clear', $importer_id, $feed_nid)), ), ); @@ -402,9 +402,9 @@ function drush_feeds_enable() { $disabled = variable_get('default_feeds_importer', array()); - foreach ($to_enable as $importer) { - unset($disabled[$importer]); - drush_log(dt("The importer '!importer' has been enabled.", array('!importer' => $importer)), 'ok'); + foreach ($to_enable as $importer_id) { + unset($disabled[$importer_id]); + drush_log(dt("The importer '!importer' has been enabled.", array('!importer' => $importer_id)), 'ok'); } variable_set('default_feeds_importer', $disabled); @@ -440,9 +440,9 @@ function drush_feeds_disable() { } $disabled = variable_get('default_feeds_importer', array()); - foreach ($to_disable as $importer) { - $disabled[$importer] = TRUE; - drush_log(dt("The importer '!importer' has been disabled.", array('!importer' => $importer)), 'ok'); + foreach ($to_disable as $importer_id) { + $disabled[$importer_id] = TRUE; + drush_log(dt("The importer '!importer' has been disabled.", array('!importer' => $importer_id)), 'ok'); } variable_set('default_feeds_importer', $disabled); feeds_cache_clear(); @@ -526,7 +526,7 @@ function drush_feeds_revert() { /** * Returns all feed instances filtered by an optional importer. * - * @param string $importer + * @param string $importer_id * (optional) The importer id. * @param int $limit * (optional) The number of feeds to return. @@ -534,9 +534,9 @@ function drush_feeds_revert() { * @return DatabaseStatementInterface * A list of feeds objects. */ -function _drush_feeds_get_all($importer = NULL, $limit = 2147483647) { - if (isset($importer)) { - return db_query_range("SELECT * FROM {feeds_source} WHERE id = :importer ORDER BY imported ASC", 0, $limit, array(':importer' => $importer)); +function _drush_feeds_get_all($importer_id = NULL, $limit = 2147483647) { + if (isset($importer_id)) { + return db_query_range("SELECT * FROM {feeds_source} WHERE id = :importer ORDER BY imported ASC", 0, $limit, array(':importer' => $importer_id)); } return db_query_range("SELECT * FROM {feeds_source} ORDER BY imported ASC", 0, $limit);