You are here

function patterns_batch_finish in Patterns 6.2

Same name and namespace in other branches
  1. 6 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

2 string references to 'patterns_batch_finish'
patterns_execute_pattern_batch in ./patterns.module
patterns_execute_pattern_drushbatch in ./patterns.drush.inc
This is a fork of patterns_execute_patterns_batch(), and will be adapted to use the drush batch api instead @todo (evergreen todo): make sure this is always in sync with patterns_execute_pattern_batch().

File

./patterns.module, line 1565
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();
}