You are here

function patterns_batch_finish in Patterns 6

Same name and namespace in other branches
  1. 6.2 patterns.module \patterns_batch_finish()
  2. 7.2 includes/core/batch.inc \patterns_batch_finish()
  3. 7 includes/core/batch.inc \patterns_batch_finish()

Finish a batch operation

1 string reference to 'patterns_batch_finish'
patterns_execute_pattern_batch in ./patterns.module

File

./patterns.module, line 1554
Enables extremely simple adding/removing features to your site with minimal to no configuration

Code

function patterns_batch_finish($success, $results, $operations) {
  $info = $_SESSION['patterns_batch_info'];
  if (empty($results['abort'])) {
    foreach ($info as $key => $i) {
      drupal_set_message(t('Pattern "@pattern" ran successfully.', array(
        '@pattern' => $i['title'],
      )));
      db_query("UPDATE {patterns} SET status = 1, enabled = '%s' WHERE pid = %d", time(), $key);
    }
  }
  else {
    $pattern = reset($info);
    drupal_set_message(t('Pattern "@pattern" ran with the errors. Check the error messages to get more details.', array(
      '@pattern' => $pattern['title'],
    )));
    drupal_set_message($results['error_message'], 'error');
  }
  unset($_SESSION['patterns_batch_info']);
  drupal_flush_all_caches();
}