You are here

browscap.install in Browscap 6.2

Install, update and uninstall functions for the Browscap module.

File

browscap.install
View source
<?php

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

// Include the browscap information retrieval functions
include_once 'import.inc';

/**
 * Implementation of hook_install.
 */
function browscap_install() {

  // Create tables
  drupal_install_schema('browscap');

  // Update the browscap information
  _browscap_import();

  // Record when the browscap information was updated
  variable_set('browscap_imported', time());
}

/**
 * Implementation of hook_schema.
 */
function browscap_schema() {
  $schema['browscap'] = array(
    'fields' => array(
      'useragent' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'type' => 'blob',
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'useragent',
    ),
  );
  $schema['cache_browscap'] = drupal_get_schema_unprocessed('system', 'cache');
  return $schema;
}

/**
 * Implementation of hook_uninstall.
 */
function browscap_uninstall() {
  drupal_uninstall_schema('browscap');
  variable_del('browscap_imported');
  variable_del('browscap_version');
  variable_del('browscap_enable_automatic_updates');
  variable_del('browscap_automatic_updates_timer');
}

/**
 * Drop the unused Browscap 1.x statistics table.
 */
function browscap_update_6200() {
  $ret = array();
  db_drop_table($ret, 'browscap_statistics');
  return $ret;
}

Functions

Namesort descending Description
browscap_install Implementation of hook_install.
browscap_schema Implementation of hook_schema.
browscap_uninstall Implementation of hook_uninstall.
browscap_update_6200 Drop the unused Browscap 1.x statistics table.