You are here

function commerce_search_api_uninstall in Commerce Search API 7

Implements hook_uninstall().

Remove the created server if it exists and if no index is using it.

File

./commerce_search_api.install, line 51
Performs (un)installation tasks for the commerce_search_api module.

Code

function commerce_search_api_uninstall() {
  if (module_exists('search_api')) {
    if ($server = search_api_server_load('frontend')) {
      $indexes = search_api_index_load_multiple(FALSE, array(
        'server' => 'frontend',
      ));
      if (empty($indexes)) {
        $server
          ->delete();
      }
    }
  }
}