datereminder.install in Date Reminder 6
Same filename and directory in other branches
Stuff Druapl needs to install this module.
File
datereminder.installView source
<?php
/**
* @file
* Stuff Druapl needs to install this module.
*/
/**
* Implements hook_install().
*/
function datereminder_install() {
content_notify('install', 'datereminder');
$ret = drupal_install_schema('datereminder');
}
/**
* Implements hook_uninstall().
*/
function datereminder_uninstall() {
$ret = drupal_uninstall_schema('datereminder');
content_notify('uninstall', 'datereminder');
// Probably could do this by getting a list of all content types
$variables = db_query("SELECT name FROM {variable} WHERE name LIKE 'datereminder%%'");
while ($variable = db_fetch_object($variables)) {
variable_del($variable->name);
}
}
/**
* Implements hook_enable().
*
* Notify content module when this module is enabled.
*/
function datereminder_enable() {
content_notify('enable', 'datereminder');
}
/**
* Implements hook_disable().
*
* Notify content module when this module is disabled.
*/
function datereminder_disable() {
content_notify('disable', 'datereminder');
}
/**
* Implements hook_schema().
*
* Tell Drupal about database tables and content.
*/
function datereminder_schema() {
$schema['datereminder_enable'] = array(
'description' => 'Reminder per-node enable flags',
'fields' => array(
'nid' => array(
'description' => 'Primary key: node id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'enabled' => array(
'description' => '0: No reminders, 1: Saved reminders, 3: Allow reminders',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
),
);
$schema['datereminder'] = array(
'description' => "Information on user's reminders",
'fields' => array(
'rid' => array(
'description' => 'Primary key, reminder id',
'type' => 'serial',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => 'node id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'uid' => array(
'description' => 'user id',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'next' => array(
'description' => 'Timestamp of next pending reminder or expiration',
'type' => 'datetime',
'size' => 'normal',
'not null' => TRUE,
),
'leadtime' => array(
'description' => 'How long before event to send reminder in seconds',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'email' => array(
'description' => 'If allowed, alternate email address',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
'expired' => array(
'description' => "If TRUE, delete after 'next'",
'type' => 'int',
'size' => 'tiny',
'default' => '0',
'not null' => TRUE,
),
),
'primary key' => array(
'rid',
),
'indexes' => array(
'uid' => array(
'uid',
),
'nid' => array(
'nid',
),
),
);
return $schema;
}
/**
* Adding new 'expired' field
*/
function datereminder_update_6003() {
$ret = array();
$fd = array(
'description' => "If TRUE, delete after 'next'",
'type' => 'int',
'size' => 'tiny',
'default' => '0',
'not null' => TRUE,
);
db_add_field($ret, 'datereminder', 'expired', $fd);
return $ret;
}
Functions
Name![]() |
Description |
---|---|
datereminder_disable | Implements hook_disable(). |
datereminder_enable | Implements hook_enable(). |
datereminder_install | Implements hook_install(). |
datereminder_schema | Implements hook_schema(). |
datereminder_uninstall | Implements hook_uninstall(). |
datereminder_update_6003 | Adding new 'expired' field |