function drush_search_api_execute_tasks in Search API 7
Execute all pending tasks or all for a given server.
File
- ./
search_api.drush.inc, line 524 - Drush commands for SearchAPI.
Code
function drush_search_api_execute_tasks($server_id = NULL) {
if (search_api_drush_static(__FUNCTION__)) {
return;
}
// Attempt to load the associated server.
$server = NULL;
if ($server_id) {
$servers = search_api_drush_get_server($server_id);
if (!$servers) {
return;
}
$server = reset($servers);
}
// Process batch op with drush.
try {
search_api_execute_pending_tasks($server);
drush_log(dt('!server tasks have been successfully executed.', array(
'!server' => $server->machine_name ? $server->machine_name : 'All',
)), 'ok');
} catch (SearchApiException $e) {
drush_log($e
->getMessage(), 'error');
}
}