prev_next.install in Previous/Next API 7.2
Same filename and directory in other branches
The (un)install and update code for the prev_next module.
File
prev_next.installView source
<?php
/**
* @file
* The (un)install and update code for the prev_next module.
*
* @ingroup prev_next
*/
/**
* Implements hook_uninstall().
*/
function prev_next_uninstall() {
db_delete('variable')
->condition('name', 'prev_next%%', 'LIKE')
->execute();
}
/**
* Implents hook_enable().
*/
function prev_next_enable() {
$max_nid = db_query('SELECT MAX(nid) FROM {node}')
->fetchField();
variable_set('prev_next_index_nid', $max_nid);
if ($max_nid) {
drupal_set_message(t('Prev/Next will index from node %nid downward.', array(
'%nid' => $max_nid,
)));
}
}
/**
* Implements hook_schema().
*/
function prev_next_schema() {
$schema['prev_next_node'] = array(
'description' => 'Prev/Next node',
'fields' => array(
'prev_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'next_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'changed' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'primary key' => array(
'nid',
),
'indexes' => array(
'prev_nid' => array(
'prev_nid',
),
'next_nid' => array(
'next_nid',
),
),
);
return $schema;
}
Functions
Name | Description |
---|---|
prev_next_enable | Implents hook_enable(). |
prev_next_schema | Implements hook_schema(). |
prev_next_uninstall | Implements hook_uninstall(). |