dynamic_background_node.install in Dynamic Background 6
Same filename and directory in other branches
Installes the database scheme and handles install and uninstall of the module.
File
modules/dynamic_background_node/dynamic_background_node.installView source
<?php
/**
* @file
* Installes the database scheme and handles install and uninstall of the
* module.
*/
/**
* Implementation of hook_schema(), which implementes the table
* dynamic_background_node that holds information about about the pr. node
* selected image.
*
* @return array $schema
*/
function dynamic_background_node_schema() {
$schema = array();
$schema['dynamic_background_node'] = array(
'description' => t(''),
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'data' => array(
'type' => 'text',
'not null' => TRUE,
),
),
'indexes' => array(
'nid' => array(
'nid',
),
'vid' => array(
'vid',
),
),
);
return $schema;
}
/**
* Implementation of hook_install().
*/
function dynamic_background_node_install() {
drupal_install_schema('dynamic_background_node');
// Make this module's weight heavy, so it overrides dynamic background main module.
db_query("UPDATE {system} SET weight = 210 WHERE type = 'module' AND name = 'dynamic_background_node'");
}
/**
* Update module weight to handle modules as less.
*/
function dynamic_background_node_update_6001() {
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = 210 WHERE type = 'module' AND name = 'dynamic_background_node'");
return $ret;
}
/**
* Implementation of hook_uninstall():
*/
function dynamic_background_node_uninstall() {
// Remove database table.
drupal_uninstall_schema('dynamic_background_node');
// Remove settings.
variable_del('dynamic_background_node');
variable_del('dynamic_background_node_imagecache');
}
Functions
Name | Description |
---|---|
dynamic_background_node_install | Implementation of hook_install(). |
dynamic_background_node_schema | Implementation of hook_schema(), which implementes the table dynamic_background_node that holds information about about the pr. node selected image. |
dynamic_background_node_uninstall | Implementation of hook_uninstall(): |
dynamic_background_node_update_6001 | Update module weight to handle modules as less. |