You are here

function patterns_batch_finish_drush in Patterns 6.2

Finish a batch operation

1 string reference to 'patterns_batch_finish_drush'
patterns_execute_pattern_drush in ./patterns.drush.inc

File

./patterns.drush.inc, line 563
Drush Patterns module commands

Code

function patterns_batch_finish_drush($success, $results, $operations) {
  $info = variable_get('patterns_details', array());
  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');
  }
  variable_del('patterns_details');
  drupal_flush_all_caches();
}