You are here

htmlmail.install in HTML Mail 8.2

Installation for HTML Mail module.

File

htmlmail.install
View source
<?php

/**
 * @file
 * Installation for HTML Mail module.
 */

/**
 * Implements hook_update_N().
 *
 * Removes variables that are no longer used.
 */
function htmlmail_update_7200() {
  variable_del('htmlmail_header');
  variable_del('htmlmail_footer');
  variable_del('htmlmail_css');
}

/**
 * Implements hook_update_N().
 *
 * Rename HTMLMailMailSystem to HTMLMailSystem.
 */
function htmlmail_update_7201() {

  // Ensure that mailsystem.module is loaded.
  drupal_load('module', 'mailsystem');
  foreach (mailsystem_get() as $name => $value) {
    if ($value == 'HTMLMailMailSystem') {
      mailsystem_set(array(
        $name => 'HTMLMailSystem',
      ));
    }
  }
}

/**
 * Implements hook_update_N().
 *
 * Increase module weight so dependent modules get loaded first.
 */
function htmlmail_update_7202() {
  db_query("UPDATE {system} SET weight = 10 WHERE type = 'module' AND name = 'htmlmail'");
}

/**
 * Implements hook_enable().
 */
function htmlmail_enable() {
  module_load_include('module', 'mailsystem');
  mailsystem_set(array(
    'htmlmail' => 'HTMLMailSystem',
  ));
}

/**
 * Implements hook_disable().
 */
function htmlmail_disable() {

  // Check is necessary because a 7.x-1.x to 7.x-2.x upgrade
  // may not have mailsystem installed.
  if (function_exists('mailsystem_clear')) {
    mailsystem_clear(array(
      'htmlmail' => 'HTMLMailSystem',
    ));
  }
}

/**
 * Implements hook_install().
 */
function htmlmail_install() {
  htmlmail_update_7202();
}

/**
 * Implements hook_uninstall().
 */
function htmlmail_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'htmlmail_%'");
  cache_clear_all('variables', 'cache');
}

Functions

Namesort descending Description
htmlmail_disable Implements hook_disable().
htmlmail_enable Implements hook_enable().
htmlmail_install Implements hook_install().
htmlmail_uninstall Implements hook_uninstall().
htmlmail_update_7200 Implements hook_update_N().
htmlmail_update_7201 Implements hook_update_N().
htmlmail_update_7202 Implements hook_update_N().