function patterns_batch_finish in Patterns 7
Same name and namespace in other branches
- 6.2 patterns.module \patterns_batch_finish()
- 6 patterns.module \patterns_batch_finish()
- 7.2 includes/core/batch.inc \patterns_batch_finish()
Finishes a batch operation. @TODO Doc.
1 string reference to 'patterns_batch_finish'
- patterns_execute_pattern_batch in includes/
core/ batch.inc - Starts preliminary operations for pattern execution.
File
- includes/
core/ batch.inc, line 175 - Running patterns using Drupal's batch API.
Code
function patterns_batch_finish($success, $results, $operations) {
$info = $_SESSION['patterns_batch_info'];
$section = $results['section'];
if (empty($results['abort'])) {
foreach ($info as $key => $i) {
drupal_set_message(t('Section "@section" of pattern "@pattern" ran successfully.', array(
'@pattern' => $i['title'],
'@section' => $section,
)));
$query_params = array(
':time' => time(),
// Note: time() != $_SERVER['REQUEST_TIME']
':pid' => $key,
':en' => PATTERNS_STATUS_ENABLED,
);
db_query("UPDATE {patterns} SET status = :en, enabled = :time WHERE pid = :pid", $query_params);
}
}
else {
$pattern = reset($info);
drupal_set_message(t('Section "@section" of pattern "@pattern" ran with errors. Check the error messages to get more details.', array(
'@pattern' => $pattern['title'],
'@section' => $section,
)), 'error');
drupal_set_message($results['error_message'], 'error');
}
unset($_SESSION['patterns_batch_info']);
drupal_flush_all_caches();
}