You are here

function _feedapi_invoke_purge in FeedAPI 6

Same name and namespace in other branches
  1. 5 feedapi.module \_feedapi_invoke_purge()

Helper function for feedapi_invoke(). Delete all feed items of a feed.

1 call to _feedapi_invoke_purge()
feedapi_invoke in ./feedapi.module
Invoke feedapi API callback functions.

File

./feedapi.module, line 1316
Handle the submodules (for feed and item processing) Provide a basic management of feeds

Code

function _feedapi_invoke_purge(&$feed, $param) {
  $node = node_load($feed->nid);
  if ($param == 'items') {
    return drupal_get_form('feedapi_purge_confirm', $node);
  }

  // Delete items from the processors
  foreach ($feed->processors as $processor) {

    // FIXME: it's possible now to accidentally delete an item from another processor
    module_invoke($processor, 'feedapi_item', 'purge', $feed);
  }

  // Closing step: Call after purge hook
  foreach (module_implements('feedapi_after_purge') as $module) {
    $func = $module . '_feedapi_after_purge';
    $func($feed);
  }

  // Reset hash.
  db_query("UPDATE {feedapi} SET hash = 0 WHERE nid = %d", $feed->nid);
}