You are here

search_api_exclude.install in Search API exclude 7

Install, update and uninstall functions for the Search API Exclude module.

File

search_api_exclude.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the Search API Exclude module.
 */

/**
 * Implements hook_schema().
 */
function search_api_exclude_schema() {
  $schema['search_api_exclude'] = array(
    'description' => 'Stores the nodes which are excluded from indexing.',
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function search_api_exclude_uninstall() {
  variable_del('search_api_exclude_types');
}

/**
 * Adapts the {search_api_exclude} table to only store excluded nodes.
 */
function search_api_exclude_update_7101() {
  db_delete('search_api_exclude')
    ->condition('node_exclude', 0)
    ->execute();
  db_drop_index('search_api_exclude', 'node_exclude');
  db_drop_field('search_api_exclude', 'node_exclude');
  $spec = array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
  );
  db_change_field('search_api_exclude', 'nid', 'nid', $spec);
  t('The update has been successfully executed. Please re-index content on all affected Search API indexes for the node exclusion to take effect.');
}

Functions

Namesort descending Description
search_api_exclude_schema Implements hook_schema().
search_api_exclude_uninstall Implements hook_uninstall().
search_api_exclude_update_7101 Adapts the {search_api_exclude} table to only store excluded nodes.