You are here

admin_menu.install in Administration menu 5.3

File

admin_menu.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function admin_menu_install() {

  // Create cache table.
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {cache_admin_menu} (\n        cid varchar(255) NOT NULL default '',\n        data longblob,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid),\n        INDEX expire (expire)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {cache_admin_menu} (\n        cid varchar(255) NOT NULL default '',\n        data bytea,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid)\n      )");
      db_query("CREATE INDEX {cache_admin_menu}_expire_idx ON {cache_admin_menu} (expire)");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function admin_menu_uninstall() {

  // Remove cache table.
  db_query("DROP TABLE {cache_admin_menu}");

  // Delete variables.
  variable_del('admin_menu_devel_modules_enabled');
  variable_del('admin_menu_margin_top');
  variable_del('admin_menu_position_fixed');
  variable_del('admin_menu_tweak_menu');
  variable_del('admin_menu_tweak_modules');
  variable_del('admin_menu_tweak_tabs');
}

/**
 * #224605: Rebuild cached menu for users.
 */
function admin_menu_update_5202() {
  $ret = array();

  // Clear CSS preprocessor cache.
  drupal_clear_css_cache();

  // Clear cache_menu.
  cache_clear_all(NULL, 'cache_menu');
  return $ret;
}

/**
 * Add {cache_admin_menu} table.
 */
function admin_menu_update_5300() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE {cache_admin_menu} (\n        cid varchar(255) NOT NULL default '',\n        data longblob,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid),\n        INDEX expire (expire)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */");
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE TABLE {cache_admin_menu} (\n        cid varchar(255) NOT NULL default '',\n        data bytea,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid)\n      )");
      $ret[] = update_sql("CREATE INDEX {cache_admin_menu}_expire_idx ON {cache_admin_menu} (expire)");
      break;
  }
  return $ret;
}

Functions

Namesort descending Description
admin_menu_install Implementation of hook_install().
admin_menu_uninstall Implementation of hook_uninstall().
admin_menu_update_5202 #224605: Rebuild cached menu for users.
admin_menu_update_5300 Add {cache_admin_menu} table.