You are here

function dhtml_menu_update_6000 in DHTML Menu 6.2

Same name and namespace in other branches
  1. 8 dhtml_menu.install \dhtml_menu_update_6000()
  2. 6.4 dhtml_menu.install \dhtml_menu_update_6000()
  3. 6.3 dhtml_menu.install \dhtml_menu_update_6000()
  4. 7 dhtml_menu.install \dhtml_menu_update_6000()

#6000:

  • Replace outdated DHTML blocks with normal menu blocks, enable DHTML for these blocks.
  • Fix a typo in one of the variable names.

File

./dhtml_menu.install, line 40
dhtml_menu.install Install and Uninstall processes for this module.

Code

function dhtml_menu_update_6000() {
  if ($old_variable = variable_get('dhtml_menus_menus', FALSE)) {
    variable_set('dhtml_menu_menus', $old_variable);
    variable_del('dhtml_menus_menus');
  }
  $dhtml_menu_menus = variable_get('dhtml_menu_menus', array());
  $result = db_query("SELECT delta, region, weight, theme FROM {blocks} WHERE module = 'dhtml_menu' AND status = 1");
  while ($row = db_fetch_array($result)) {
    $dhtml_menu_menus[$row['delta']] = 1;
    $module = $row['delta'] == 'navigation' ? 'user' : 'menu';
    if ($row['delta'] == 'navigation') {
      $row['delta'] = 1;
    }
    $ret[] = update_sql("UPDATE {blocks} SET status = 1, region = '{$row['region']}', weight = '{$row['weight']}' WHERE module = '{$module}' AND delta = '{$row['delta']}' AND theme = '{$row['theme']}'");
  }
  $ret[] = update_sql("DELETE FROM {blocks} WHERE module = 'dhtml_menu'");
  drupal_set_message(t('DHTML Menu no longer provides its own blocks. If your navigation menu appears to be missing, you will need to re-enable it manually in the <a href="@url">block administration</a>', array(
    '@url' => url('admin/build/block'),
  )), 'warning');
  variable_set('dhtml_menu_menus', $dhtml_menu_menus);
  return $ret;
}