? path_redirect.917374.patch
Index: path_redirect.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/path_redirect/path_redirect.module,v
retrieving revision 1.3.2.7.2.104
diff -u -p -r1.3.2.7.2.104 path_redirect.module
--- path_redirect.module	10 Aug 2010 04:46:01 -0000	1.3.2.7.2.104
+++ path_redirect.module	20 Sep 2010 19:29:40 -0000
@@ -161,6 +161,17 @@ function path_redirect_cron() {
       watchdog('path_redirect', format_plural(count($rids), 'Removed 1 inactive redirect from the database.', 'Removed @count inactive redirects from the database.'));
     }
   }
+
+  // Purge looping redirects
+  $query = db_query("SELECT rid FROM {path_redirect} WHERE source = redirect");
+  $rids = array();
+  while ($rid = db_result($query)) {
+    $rids[] = $rid;
+  }
+  if ($rids) {
+    path_redirect_delete_multiple($rids);
+    watchdog('path_redirect', format_plural(count($rids), 'Removed 1 looping redirect from the database.', 'Removed @count looping redirects from the database.'));
+  }
 }
 
 /**
