function patterns_batch_actions_drush in Patterns 6.2
Execute a batch action
1 string reference to 'patterns_batch_actions_drush'
File
- ./
patterns.drush.inc, line 529 - Drush Patterns module commands
Code
function patterns_batch_actions_drush($action, $place, $actions_map, &$context) {
patterns_load_components();
// Nothing to do if there is no action
if (empty($action)) {
$context['finished'] = 1;
return;
}
// Start a timer. Since we want each action to be its own http request, we need
// to ensure the batch api will decide to do it like that by making each action
// take at least a second to execute
timer_start('patterns_action');
// skip action execution if an error is encountered in some of the previous operations
if (!empty($context['results']['abort'])) {
return;
}
$result = patterns_implement_action($action, $context['results']['identifiers'], $place, $actions_map);
if (!$result['success']) {
// we use 'results' to keep track of errors and abort execution if required
$context['results']['abort'] = TRUE;
$context['results']['error_message'] = $result['error_message'];
}
if (timer_read('patterns_action') < 1000) {
@usleep(1000 - timer_read('patterns_action'));
}
}