You are here

function tweet_feed_export in Tweet Feed 7.3

tweet_feed_export() Export all current settings and configurations

1 string reference to 'tweet_feed_export'
tweet_feed_menu in ./tweet_feed.module
Implements hook_menu().

File

./tweet_feed_admin.inc, line 697

Code

function tweet_feed_export() {
  $export_data = array();
  $result = db_select('tweet_accounts', 'a')
    ->fields('a')
    ->orderBy('account_name', 'ASC')
    ->execute();
  while ($account = $result
    ->fetchObject()) {

    // Determine how many queries this feed is responsible for
    $feed_result = db_select('tweet_feeds', 'f')
      ->fields('f')
      ->condition('f.aid', $account->aid)
      ->execute();
    $export_data[$account->aid]['account'] = $account;
    while ($feed = $feed_result
      ->fetchObject()) {
      $export_data[$account->aid]['feeds'][$feed->fid] = $feed;
    }
  }
  $output = json_encode($export_data);
  header('Content-Type: text/json');
  header('Content-Disposition: attachment; filename="tweet-feed-settings.json"');
  print $output;
  exit;
}