You are here

public static function FeedImport::saveFeed in Feed Import 7.2

Same name and namespace in other branches
  1. 7.3 feed_import_base/inc/feed_import.inc \FeedImport::saveFeed()
  2. 7 feed_import.inc.php \FeedImport::saveFeed()

Save/update a feed

Parameters

array $feed: Feed info array

bool $update: Update feed if true, save if false

5 calls to FeedImport::saveFeed()
feed_import_add_new_feed_form_submit in ./feed_import.module
Add new feed form submit
feed_import_edit_feed_form_submit in ./feed_import.module
Edit feed form submit
feed_import_edit_filter_form_submit in ./feed_import.module
Edit filter form submit
feed_import_import_feed_form_submit in ./feed_import.module
Feed import form submit
feed_import_reorder_fields_form_submit in ./feed_import.module
Re-order fields form submit.

File

./feed_import.inc.php, line 79
Feed import class for parsing and processing content.

Class

FeedImport
@file Feed import class for parsing and processing content.

Code

public static function saveFeed($feed, $update = FALSE) {
  if ($update) {
    db_update('feed_import_settings')
      ->fields(array(
      'enabled' => $feed['enabled'],
      'name' => $feed['name'],
      'machine_name' => $feed['machine_name'],
      'url' => $feed['url'],
      'time' => $feed['time'],
      'entity_info' => serialize($feed['entity_info']),
      'xpath' => serialize($feed['xpath']),
    ))
      ->condition('id', $feed['id'], '=')
      ->execute();
  }
  else {
    db_insert('feed_import_settings')
      ->fields(array(
      'enabled' => $feed['enabled'],
      'name' => $feed['name'],
      'machine_name' => $feed['machine_name'],
      'url' => $feed['url'],
      'time' => $feed['time'],
      'entity_info' => serialize($feed['entity_info']),
      'xpath' => serialize($feed['xpath']),
    ))
      ->execute();
  }
}