You are here

function search_api_grouping_cron in Search API Grouping 7.2

Implements hook_cron().

1 call to search_api_grouping_cron()
SearchApiDenormalizedEntityDataSourceController::startTracking in includes/datasource_denormalized_entity.inc
Initialize tracking of the index status of items for the given indexes.

File

./search_api_grouping.module, line 336
Module search_api_grouping.

Code

function search_api_grouping_cron() {

  // Iterate over all indexes with grouping enabled and queue the permutation
  // generation.
  $indexes = search_api_index_load_multiple(FALSE);
  foreach ($indexes as $index) {
    if ($index
      ->datasource() instanceof SearchApiDenormalizedEntityDataSourceController) {

      // Since this is datasource specific we simply use the first index to
      // handle the overall maintenance.
      // Ensure the data in table are consistent.
      $index
        ->datasource()
        ->cleanTable();

      // Ensure all the required permutations are available.
      $index
        ->datasource()
        ->queuePermutationGeneration();
      break;
    }
  }
}