You are here

function admin_menu_update_7304 in Administration menu 7.3

Remove obsolete 'admin_menu' menu and all orphan links in it.

File

./admin_menu.install, line 106
Install, update, and uninstall functions for the admin menu module.

Code

function admin_menu_update_7304() {

  // Remove the custom menu used by 6.x-1.x.
  if (db_table_exists('menu_custom')) {
    db_delete('menu_custom')
      ->condition('menu_name', 'admin_menu')
      ->execute();
  }

  // 6.x-1.x cloned the entire link structure below the path 'admin' into a
  // separate 'menu_name' "admin_menu" with 'module' "admin_menu". 6.x-3.x and
  // early alpha versions of 7.x-3.x still did something similar. All of these
  // records are obsolete. Removal of the 'module' records (without different
  // menu_name) is particularly important, since they would otherwise appear
  // as duplicate links.
  db_delete('menu_links')
    ->condition(db_or()
    ->condition('module', 'admin_menu')
    ->condition('menu_name', 'admin_menu'))
    ->execute();
}