Download & Extend

Deleting menu items

Project:Admin
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

In the code:

<?php
/**
* Implementation of hook_enable().
*/
function admin_enable() {
 
$result = db_query("SELECT * FROM {menu_links} WHERE link_path LIKE 'admin%'");
  while (
$item = db_fetch_array($result)) {
   
_menu_delete_item($item, TRUE);
  }
 
menu_rebuild();

 
// Weight admin to come after other modules -- in particular, admin_theme().
 
db_query("UPDATE {system} SET weight = 1 WHERE name = 'admin' AND type = 'module'");
}
?>

Delete all menu links that begin with admin/*. This is crazy!. If you have added items to the menu such navigation. This module deleted all my admin links without my consent. I think this can not be so without asking.

Comments

#1

That's really, really dangerous. I had a database backup just a few minutes before enabling this module, thanks $deity. That sql query should only filter menu_links from module_name, insted of link_path (at least, although I think to remove menu entries on enabling a module is quite dangerous).

#2

Duplicate issue. See http://drupal.org/node/611254 Deletes any custom menu links that start with admin

nobody click here