vars.install in Variable API 7
Same filename and directory in other branches
Install, update and uninstall functions for the Variable API module.
File
vars.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Variable API module.
*/
/**
* Implements hook_schema().
*/
function vars_schema() {
$schema = array();
$schema['variable_default'] = array(
'description' => 'The default values for the variables as set by the modules.',
'fields' => array(
'vdid' => array(
'description' => 'The primary key.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'module' => array(
'description' => 'The module owning the variable.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'name' => array(
'description' => 'The name of the variable.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'value' => array(
'description' => 'The value of the variable.',
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
),
'flags' => array(
'description' => 'Flags associated with the variable.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
),
),
'indexes' => array(
'module' => array(
array(
'module',
32,
),
),
'name' => array(
array(
'name',
32,
),
),
'flags' => array(
'flags',
),
),
'unique key' => array(
'module_name' => array(
'module',
'name',
),
),
'primary key' => array(
'vdid',
),
);
$schema['cache_vars'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_vars']['description'] = 'Cache table for the Variable API module.';
return $schema;
}
/**
* Implements hook_install().
*/
function vars_install() {
db_query("UPDATE {system} SET weight = -99 WHERE name = 'vars' AND type = 'module'");
}
/**
* Flush the module cache.
*/
function vars_update_7102() {
cache_clear_all('*', 'cache_vars', TRUE);
}
/**
* Update the module weight.
*/
function vars_7103() {
db_query("UPDATE {system} SET weight = -99 WHERE name = 'vars' AND type = 'module'");
}
Functions
Name | Description |
---|---|
vars_7103 | Update the module weight. |
vars_install | Implements hook_install(). |
vars_schema | Implements hook_schema(). |
vars_update_7102 | Flush the module cache. |