? modules/syndication
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.76
diff -u -p -r1.76 install.inc
--- includes/install.inc	16 Nov 2008 23:44:47 -0000	1.76
+++ includes/install.inc	17 Nov 2008 06:37:08 -0000
@@ -585,43 +585,17 @@ function drupal_install_system() {
  *   The modules to uninstall.
  */
 function drupal_uninstall_modules($module_list = array()) {
-  foreach ($module_list as $module) {
-    // First, retrieve all the module's menu paths from db.
-    drupal_load('module', $module);
-    $paths = module_invoke($module, 'menu');
-
-    // Uninstall the module.
-    module_load_install($module);
-    module_invoke($module, 'uninstall');
-
-    // Now remove the menu links for all paths declared by this module.
-    if (!empty($paths)) {
-      $paths = array_keys($paths);
-      // Clean out the names of load functions.
-      foreach ($paths as $index => $path) {
-        $parts = explode('/', $path, MENU_MAX_PARTS);
-        foreach ($parts as $k => $part) {
-          if (preg_match('/^%[a-z_]*$/', $part)) {
-            $parts[$k] = '%';
-          }
-        }
-        $paths[$index] = implode('/', $parts);
-      }
-      $placeholders = implode(', ', array_fill(0, count($paths), "'%s'"));
-
-      $result = db_query('SELECT * FROM {menu_links} WHERE router_path IN (' . $placeholders . ') AND external = 0 ORDER BY depth DESC', $paths);
-      // Remove all such items. Starting from those with the greatest depth will
-      // minimize the amount of re-parenting done by menu_link_delete().
-      while ($item = db_fetch_array($result)) {
-        _menu_delete_item($item, TRUE);
-      }
+  if (!empty($module_list)) {
+    foreach ($module_list as $module) {
+      // Uninstall the module.
+      // Is this drupal_load still needed?
+      drupal_load('module', $module);
+      module_load_install($module);
+      module_invoke($module, 'uninstall');
+      drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED);
     }
 
-    drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED);
-  }
-
-  if (!empty($module_list)) {
-    // Call hook_module_uninstall to let other modules act
+    // Call hook_module_uninstalled to let other modules act.
     module_invoke_all('modules_uninstalled', $module_list);
   }
 }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.638
diff -u -p -r1.638 system.module
--- modules/system/system.module	15 Nov 2008 08:23:07 -0000	1.638
+++ modules/system/system.module	17 Nov 2008 06:37:10 -0000
@@ -2150,3 +2150,37 @@ function theme_meta_generator_header($ve
 function system_image_toolkits() {
   return array('gd');
 }
+
+/**
+ * Implementation of hook_modules_uninstalled().
+ *
+ * Remove the uninstalled modules' menu items.
+ */
+function system_modules_uninstalled($modules) {
+  foreach ($modules as $module) {
+    // Retrieve all the module's menu paths.
+    $paths = module_invoke($module, 'menu');
+
+    // Now remove the menu links for all paths declared by this module.
+    if (!empty($paths)) {
+      $paths = array_keys($paths);
+      // Clean out the names of load functions.
+      foreach ($paths as $index => $path) {
+        $parts = explode('/', $path, MENU_MAX_PARTS);
+        foreach ($parts as $k => $part) {
+          if (preg_match('/^%[a-z_]*$/', $part)) {
+            $parts[$k] = '%';
+          }
+        }
+        $paths[$index] = implode('/', $parts);
+      }
+
+      $result = db_query('SELECT * FROM {menu_links} WHERE router_path IN (' . db_placeholders($paths, 'varchar') . ') AND external = 0 ORDER BY depth DESC', $paths, array(PDO::FETCH_ASSOC));
+      // Remove all such items. Starting from those with the greatest depth will
+      // minimize the amount of re-parenting done by menu_link_delete().
+      foreach ($result as $item) {
+        _menu_delete_item($item, TRUE);
+      }
+    }
+  }
+}
