You are here

function patterns_export_batch_finish in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns_export/core.inc \patterns_export_batch_finish()

Finishes a batch operation. @TODO Doc.

1 string reference to 'patterns_export_batch_finish'
patterns_export_batch in patterns_export/core.inc
Constructs the abstract representation of the exported pattern invoking the Batch API

File

patterns_export/core.inc, line 206

Code

function patterns_export_batch_finish($success, $results, $operations) {
  $modules = $_SESSION['patterns_export_batch_info']['modules'];
  if (empty($results['abort'])) {
    foreach ($modules as $m) {
      drupal_set_message(t('Component "@component" ran successfully.', array(
        '@component' => $m,
      )));
    }
    $to = $_SESSION['patterns_export_batch_info']['to'];
    $info = $_SESSION['patterns_export_batch_info']['info'];
    $format = $_SESSION['patterns_export_batch_info']['format'];
    $filename = $_SESSION['patterns_export_batch_info']['filename'];
    unset($_SESSION['patterns_export_batch_info']);
    return patterns_export_finalize_export($to, $results['sections'], $info, $results['modules'], $format, $filename);
  }
  else {
    drupal_set_message(t('An error occurred during the export.'), 'error');
    drupal_set_message($results['error_message'], 'error');
    unset($_SESSION['patterns_export_batch_info']);
    return FALSE;
  }
}