You are here

prev_next.install in Previous/Next API 7

Same filename and directory in other branches
  1. 8.2 prev_next.install
  2. 6 prev_next.install
  3. 7.2 prev_next.install

The (un)install and update code for the prev_next module.

File

prev_next.install
View source
<?php

/**
 * @file
 * The (un)install and update code for the prev_next module.
 *
 * @ingroup prev_next
 */

/**
 * @todo Please document this function.
 * @see http://drupal.org/node/1354
 */
function prev_next_uninstall() {
  db_delete('variable')
    ->condition('name', 'prev_next%%', 'LIKE')
    ->execute();
}

/**
 * @todo Please document this function.
 * @see http://drupal.org/node/1354
 */
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,
    )));
  }
}

/**
 * @todo Please document this function.
 * @see http://drupal.org/node/1354
 */
function prev_next_schema() {
  $schema['prev_next_node'] = array(
    'description' => 'Prev/Next node',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'prev_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

Namesort descending Description
prev_next_enable @todo Please document this function.
prev_next_schema @todo Please document this function.
prev_next_uninstall @todo Please document this function.