You are here

location_search.install in Location 7.4

Installation routines for location_search_new.

File

contrib/location_search/location_search.install
View source
<?php

/**
 * @file
 * Installation routines for location_search_new.
 */

/**
 * Implementation of hook_schema().
 */
function location_search_schema() {
  $schema['location_search_work'] = array(
    'description' => 'List of lids to index.',
    'fields' => array(
      'lid' => array(
        'description' => 'Primary Key: location ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'lid',
    ),
  );
  return $schema;
}

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

  // Force reindexing.
  db_query('INSERT INTO {location_search_work} (SELECT lid FROM {location})');
}

/**
 * Implementation of hook_uninstall().
 */
function location_search_uninstall() {
  variable_del('location_search_map');
  variable_del('location_search_map_address');
  variable_del('location_search_map_macro');
}

/**
 * Rewritten location_search -- Uses the fulltext engine.
 */
function location_search_update_5300() {
  $ret = array();

  // Create our worklist table.
  $schema['location_search_work'] = array(
    'description' => 'List of lids to index.',
    'fields' => array(
      'lid' => array(
        'description' => 'Primary Key: location ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'lid',
    ),
  );
  db_create_table($ret, 'location_search_work', $schema['location_search_work']);

  // Force reindexing.
  $ret[] = update_sql('INSERT INTO {location_search_work} (SELECT lid FROM {location})');

  // Remove unused variables.
  variable_del('location_suppress_country');
  variable_del('location_search_distance_unit');
  return $ret;
}

Functions

Namesort descending Description
location_search_install Implementation of hook_install().
location_search_schema Implementation of hook_schema().
location_search_uninstall Implementation of hook_uninstall().
location_search_update_5300 Rewritten location_search -- Uses the fulltext engine.