You are here

dynamic_background_user.install in Dynamic Background 6

Installes the database scheme and handles install and uninstall of the module.

File

modules/dynamic_background_user/dynamic_background_user.install
View source
<?php

/**
 * @file
 * Installes the database scheme and handles install and uninstall of the
 * module.
 */

/**
 * Implementation of hook_schema(), which create the dynamic background table
 * used to store information about user selection of images.
 */
function dynamic_background_user_schema() {
  $schema = array();
  $schema['dynamic_background_user'] = array(
    'description' => t('Stores information about dynamic backgrounds for each user'),
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'data' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function dynamic_background_user_install() {
  drupal_install_schema('dynamic_background_user');

  // Make this module's weight heavy, so it overrides dynamic background main module.
  db_query("UPDATE {system} SET weight = 230 WHERE type = 'module' AND name = 'dynamic_background_user'");
}

/**
 * Implementation of hook_uninstall():
 */
function dynamic_background_user_uninstall() {

  // Remove database table.
  drupal_uninstall_schema('dynamic_background_user');

  // Remove settings.
  variable_del('dynamic_background_user');
  variable_del('dynamic_background_user_imagecache');
}

/**
 * Update module weight to handle modules as less.
 */
function dynamic_background_user_update_6001() {
  $ret = array();
  $ret[] = update_sql("UPDATE {system} SET weight = 230 WHERE type = 'module' AND name = 'dynamic_background_user'");
  return $ret;
}

Functions

Namesort descending Description
dynamic_background_user_install Implementation of hook_install().
dynamic_background_user_schema Implementation of hook_schema(), which create the dynamic background table used to store information about user selection of images.
dynamic_background_user_uninstall Implementation of hook_uninstall():
dynamic_background_user_update_6001 Update module weight to handle modules as less.