You are here

flipping_book.install in Flipping Book 7

Install, update and uninstall functions for the flipping_book module.

File

flipping_book.install
View source
<?php

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

/**
 * Implements hook_schema().
 */
function flipping_book_schema() {
  $schema['flipping_book'] = array(
    'description' => 'Flipping Book files.',
    'fields' => array(
      'fbid' => array(
        'description' => 'The primary identifier for a flipping_book row.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The title of the flipping_book.',
      ),
      'dir' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'description' => 'The directory of the flipping_book',
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the flipping_book was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'unique keys' => array(
      'fbid_dir' => array(
        'fbid',
        'dir',
      ),
      'dir' => array(
        'dir',
      ),
    ),
    'primary key' => array(
      'fbid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function flipping_book_install() {
  flipping_book_prepare_directory();
}

/**
 * Implements hook_uninstall().
 */
function flipping_book_uninstall() {
  $dir = variable_get('flipping_book_schema', 'public') . '://flipping_book';
  file_unmanaged_delete_recursive($dir);
  variable_del('flipping_book_schema');
}

Functions