You are here

function search_api_execute_pending_tasks in Search API 7

Provides a batch wrapper for search_api_server_tasks_check().

Parameters

SearchApiServer|null $server: (optional) The server whose tasks should be executed, or NULL to execute tasks for all servers.

1 call to search_api_execute_pending_tasks()
drush_search_api_execute_tasks in ./search_api.drush.inc
Execute all pending tasks or all for a given server.
1 string reference to 'search_api_execute_pending_tasks'
search_api_menu in ./search_api.module
Implements hook_menu().

File

./search_api.module, line 1514
Provides a flexible framework for implementing search services.

Code

function search_api_execute_pending_tasks(SearchApiServer $server = NULL) {
  batch_set(array(
    'title' => t('Processing pending tasks'),
    'operations' => array(
      array(
        'search_api_execute_pending_tasks_batch',
        array(
          $server,
        ),
      ),
    ),
    'finished' => 'search_api_execute_pending_tasks_finished',
  ));
  if ($server) {
    $path = 'admin/config/search/search_api/server/' . $server->machine_name;
  }
  else {
    $path = 'admin/config/search/search_api';
  }
  if (function_exists('drush_backend_batch_process')) {
    drush_backend_batch_process();
  }
  else {
    batch_process($path);
  }
}