You are here

function aggregator_remove in Drupal 6

Same name and namespace in other branches
  1. 4 modules/aggregator.module \aggregator_remove()
  2. 5 modules/aggregator/aggregator.module \aggregator_remove()
  3. 7 modules/aggregator/aggregator.module \aggregator_remove()

Removes all items from a feed.

Parameters

$feed: An associative array describing the feed to be cleared.

1 call to aggregator_remove()
aggregator_admin_remove_feed_submit in modules/aggregator/aggregator.admin.inc
Remove all items from a feed and redirect to the overview page.

File

modules/aggregator/aggregator.module, line 451
Used to aggregate syndicated content (RSS, RDF, and Atom).

Code

function aggregator_remove($feed) {
  $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d', $feed['fid']);
  while ($item = db_fetch_object($result)) {
    $items[] = "iid = {$item->iid}";
  }
  if (!empty($items)) {
    db_query('DELETE FROM {aggregator_category_item} WHERE ' . implode(' OR ', $items));
  }
  db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']);
  db_query("UPDATE {aggregator_feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']);
  drupal_set_message(t('The news items from %site have been removed.', array(
    '%site' => $feed['title'],
  )));
}