You are here

auto_expire.install in Auto Expire 7

Same filename and directory in other branches
  1. 5 auto_expire.install

Install, update and uninstall functions for the Auto Expire module.

File

auto_expire.install
View source
<?php

// $Id: auto_expire.install,v 1.6 2009/06/28 22:55:18 marcvangend Exp $

/**
 * @file
 * Install, update and uninstall functions for the Auto Expire module.
 */

//require 'auto_expire.inc';

/**
 * Implements hook_schema().
 */
function auto_expire_schema() {
  $schema['auto_expire'] = array(
    'description' => 'Auto expire module: track node expirations',
    'fields' => array(
      'nid' => array(
        'description' => 'node id: primary key',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'warned' => array(
        'description' => 'warned flag: whether email has been sent out',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'expire' => array(
        'description' => 'expire date: Unix timestamp',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'extended' => array(
        'description' => 'number of times the node expiry has been extended',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function auto_expire_install() {

  // Create tables.
}

/**
 * Implements hook_uninstall().
 */
function auto_expire_uninstall() {

  // Remove tables.
  foreach (node_type_get_types() as $type => $name) {
    $code = AUTO_EXPIRE_NODE_TYPE . $type;
    variable_del($code . '_e');
    variable_del($code . '_d');
    variable_del($code . '_w');
    variable_del($code . '_p');
  }
  variable_del(AUTO_EXPIRE_EMAIL . 'warn_subject');
  variable_del(AUTO_EXPIRE_EMAIL . 'warn_body');
  variable_del(AUTO_EXPIRE_EMAIL . 'expired_subject');
  variable_del(AUTO_EXPIRE_EMAIL . 'expired_body');
}

Functions