You are here

function fuzzysearch_disable in Fuzzy Search 7

Implements hook_disable().

File

./fuzzysearch.install, line 49
Install and update hook implementations of the fuzzysearch module.

Code

function fuzzysearch_disable() {
  $query = db_select('search_api_server', 's');
  $query
    ->addField('s', 'machine_name');
  $query
    ->condition('class', 'fuzzysearch_service');
  $servers = $query
    ->execute()
    ->fetchAssoc();
  foreach ($servers as $server) {

    // Disable indexes.
    db_update('search_api_index')
      ->condition('server', $server)
      ->fields(array(
      'enabled' => 0,
    ))
      ->execute();
  }

  // Disable the servers.
  db_update('search_api_server')
    ->condition('class', 'fuzzysearch_service')
    ->fields(array(
    'enabled' => 0,
  ))
    ->execute();
}