You are here

function admin_update_6201 in Admin 6.2

Update 6201: Migrate previous permissions for "admin menu" to "use admin toolbar".

File

./admin.install, line 79

Code

function admin_update_6201() {
  $return = array();
  $result = db_query("SELECT * FROM {permission}");
  while ($row = db_fetch_object($result)) {
    $perms = explode(', ', $row->perm);
    if (in_array('admin menu', $perms, TRUE)) {
      $key = array_search('admin menu', $perms);
      $perms[$key] = 'use admin toolbar';
      $perms = implode(', ', $perms);
      $return[] = update_sql("UPDATE {permission} SET perm = '{$perms}' WHERE pid = {$row->pid}");
    }
  }

  // Remove old theme instantiation stack & reset admin theme if
  // referring to deprecated admin themes.
  variable_del('admin_theme_invalidated');
  $theme = variable_get('admin_theme', '0');
  if ($theme === 'admin' || $theme === 'slate') {
    variable_del('admin_theme');
  }
  return $return;
}