You are here

function search_api_enable in Search API 7

Implements hook_enable().

Mark all items as "dirty", since we can't know whether they are.

File

./search_api.install, line 418
Install, update and uninstall functions for the Search API module.

Code

function search_api_enable() {
  $types = array();
  foreach (search_api_index_load_multiple(FALSE) as $index) {
    if ($index->enabled) {
      $types[$index->item_type][] = $index;
    }
  }
  foreach ($types as $type => $indexes) {
    try {
      $controller = search_api_get_datasource_controller($type);
      $controller
        ->startTracking($indexes);
    } catch (SearchApiException $e) {
      watchdog_exception('search_api', $e);
    }
  }
}