It often happens that I've added and configured a load of feeds, only to discover afterwards that I should have done something differently from the start, so I need to purge and refresh all the feeds I've already created. Rather than sitting in front of admin/content/feed and clicking for hours on all the remove and refresh links, I wrote a simple script to do this for me.

<?php
set_time_limit
(0);
$types = array_keys(_feedapi_content_types_list());
$result = db_query("SELECT * FROM {node} WHERE type IN (". db_placeholders($types, 'varchar') .")", $types);
while (
$object = db_fetch_object($result)) {
 
$node = node_load($object->nid);
 
$values = array('values' => array('nid' => $node->nid));
 
drupal_execute('feedapi_purge_confirm', $values, $node);
 
feedapi_invoke_feedapi('refresh', $node->feed, TRUE);
 
drupal_set_message(t('%title refreshed.', array('%title' => $node->title)));
}
?>