You are here

function tweet_feed_process_feed in Tweet Feed 7.3

Same name and namespace in other branches
  1. 7.2 tweet_feed.module \tweet_feed_process_feed()

Iterate through the feeds and import

Used by our drush command to get all of the feed data and import the feeds accordingly.

Parameters

int fid: The feed id that we are going to process. If empty, then process them all.

1 call to tweet_feed_process_feed()
drush_tweet_feed_tf_import_tweets in ./tweet_feed.drush.inc
Import Tweets

File

./tweet_feed.module, line 299

Code

function tweet_feed_process_feed($fid = NULL) {
  if ($fid == NULL) {

    // If we're not being passed any argument, then process all the feeds.
    // Load in the fid's for active feeds and then run them through
    // tweet_feed_pull_data_from_feed
    $result = db_select('tweet_feeds', 'f')
      ->fields('f', array(
      'feed_name',
      'fid',
    ))
      ->orderBy('feed_name', 'ASC')
      ->execute();
  }
  else {

    // Otherwise, just load in the one specified
    $result = db_select('tweet_feeds', 'f')
      ->fields('f', array(
      'feed_name',
      'fid',
    ))
      ->condition('f.fid', $fid)
      ->orderBy('f.feed_name', 'ASC')
      ->execute();
  }
  while ($fdata = $result
    ->fetchObject()) {
    tweet_feed_set_message('Processing Feed: ' . $fdata->feed_name, 'ok', FALSE);
    $tweets = tweet_feed_pull_data_from_feed($fdata->fid, FALSE);
  }
}