You are here

brazilianids.install in Brazilian IDs 6

brazilianids.install Install, uninstall, enable and disable the module

File

brazilianids.install
View source
<?php

/**
 * @file
 * brazilianids.install
 *   Install, uninstall, enable and disable the module
 */

/**
 * Implementation of hook_install().
 */
function brazilianids_install() {
  if (module_exists('content')) {
    drupal_load('module', 'content');
    content_notify('install', 'brazilianids');
  }
}

/**
 * Implementation of hook_uninstall().
 */
function brazilianids_uninstall() {
  if (module_exists('content')) {
    drupal_load('module', 'content');
    content_notify('uninstall', 'brazilianids');
  }
  db_query("DELETE FROM {variable} WHERE name LIKE 'brazilianids_%%'");

  // Delete all global variables
  variable_del('brazilianids_cpf');
  variable_del('brazilianids_cnpj');
  variable_del('brazilianids_cpfcnpj');
  variable_del('brazilianids_registration');
  variable_del('brazilianids_category');
  variable_del('brazilianids_field_weight');
  variable_del('brazilianids_required');
  variable_del('brazilianids_enable_cpf');
  variable_del('brazilianids_enable_cnpj');
  variable_del('brazilianids_enable_cpfcnpj');
  cache_clear_all('variables', 'cache');
}

/**
 * Implementation of hook_enable().
 *
 * Notify content module when this module is enabled.
 */
function brazilianids_enable() {
  if (module_exists('content')) {
    drupal_load('module', 'content');
    content_notify('enable', 'brazilianids');
  }
}

/**
 * Implementation of hook_disable().
 *
 * Notify content module when this module is disabled.
 */
function brazilianids_disable() {
  if (module_exists('content')) {
    drupal_load('module', 'content');
    content_notify('disable', 'brazilianids');
  }
}

/**
 * Delete internal variable.
 */
function brazilianids_update_6000() {
  $ret = array();
  variable_del('brazilianids_category');
  $ret[] = array(
    'success' => TRUE,
    'query' => 'Deleted a obsolete variable.',
  );
  return $ret;
}

/**
 * Import new translations.
 */
function brazilianids_update_6001() {
  $ret = array();
  if (module_exists('locale')) {
    locale_system_update(array(
      'brazilianids',
    ));
    $ret[] = array(
      'success' => TRUE,
      'query' => 'New translations were imported.',
    );
  }
  return $ret;
}

Functions

Namesort descending Description
brazilianids_disable Implementation of hook_disable().
brazilianids_enable Implementation of hook_enable().
brazilianids_install Implementation of hook_install().
brazilianids_uninstall Implementation of hook_uninstall().
brazilianids_update_6000 Delete internal variable.
brazilianids_update_6001 Import new translations.