? 320303-menu-uninstall.patch
? sites/default/files
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.80
diff -u -p -r1.80 install.inc
--- includes/install.inc	30 Dec 2008 16:43:14 -0000	1.80
+++ includes/install.inc	1 Jan 2009 22:03:47 -0000
@@ -586,37 +586,12 @@ function drupal_install_system() {
  */
 function drupal_uninstall_modules($module_list = array()) {
   foreach ($module_list as $module) {
-    // First, retrieve all the module's menu paths from db.
+    // First, load the module in case its uninstall sequence requires its code.
     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);
-      }
-    }
-
     drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED);
   }
 
