You are here

admin_language.install in Administration Language 7

Same filename and directory in other branches
  1. 6 admin_language.install

Update functions for Administration language.

File

admin_language.install
View source
<?php

/**
 * @file
 * Update functions for Administration language.
 */

/* --- HOOKS ---------------------------------------------------------------- */

/**
 * Implements hook_install().
 */
function admin_language_install() {
  db_query("UPDATE {system} SET weight = -1 WHERE name = 'admin_language'");
}

/**
 * Implements hook_uninstall().
 */
function admin_language_uninstall() {
  variable_del('admin_language_default');
  variable_del('admin_language_force_default');
  variable_del('admin_language_force_neutral');
  variable_del('admin_language_hide_node');
  variable_del('admin_language_hide_user');
  variable_del('admin_language_pages');
  variable_del('admin_language_translate_admin_menu');
  variable_del('admin_language_translate_toolbar');
  variable_del('admin_language_visibility');
  variable_del('admin_language_use_path_is_admin');
  variable_del('admin_language_path_is_admin_paths');
}

/**
 * Implements hook_schema().
 */
function admin_language_schema() {
  $schema = array();
  $schema['admin_language'] = array(
    'description' => 'Stores user admin language selections.',
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique user ID.',
        'default' => 0,
      ),
      'language' => array(
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
        'description' => "User's default administration language.",
      ),
    ),
    'unique keys' => array(
      'uid_language' => array(
        'uid',
        'language',
      ),
    ),
    'primary key' => array(
      'uid',
    ),
  );
  return $schema;
}

/**
 * Create the database table if it doesn't exist.
 */
function admin_language_update_7000() {
  if (!db_table_exists('admin_language')) {
    drupal_install_schema('admin_language');
  }
}

Functions

Namesort descending Description
admin_language_install Implements hook_install().
admin_language_schema Implements hook_schema().
admin_language_uninstall Implements hook_uninstall().
admin_language_update_7000 Create the database table if it doesn't exist.