You are here

facetapi.install in Facet API 6

Same filename and directory in other branches
  1. 6.3 facetapi.install
  2. 7.2 facetapi.install
  3. 7 facetapi.install

Installation functions for the Facet API module.

File

facetapi.install
View source
<?php

/**
 * @file
 * Installation functions for the Facet API module.
 */

/**
 * Implementation of hook_schema().
 */
function facetapi_schema() {
  $schema = array();
  $schema['cache_facetapi'] = array(
    'description' => 'Cached Facet API data.',
    'fields' => array(
      'cid' => array(
        'description' => 'Primary Key: Unique cache ID.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'A collection of data to cache.',
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
      ),
      'expire' => array(
        'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'created' => array(
        'description' => 'A Unix timestamp indicating when the cache entry was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'headers' => array(
        'description' => 'Any custom HTTP headers to be added to cached data.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'serialized' => array(
        'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'expire' => array(
        'expire',
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function facetapi_install() {
  drupal_install_schema('facetapi');
}

/**
 * Implementation of hook_uninstall().
 */
function facetapi_uninstall() {
  drupal_uninstall_schema('facetapi');

  // Removes all variables that start with "facetapi:"
  if ($result = db_query("SELECT name FROM {variable} WHERE name LIKE 'facetapi:%%'")) {
    while ($row = db_fetch_object($result)) {
      variable_del($row->name);
    }
  }
}

Functions

Namesort descending Description
facetapi_install Implementation of hook_install().
facetapi_schema Implementation of hook_schema().
facetapi_uninstall Implementation of hook_uninstall().