You are here

function _flysystem_config_form_finish_batch in Flysystem 7

Finishes a batch.

1 string reference to '_flysystem_config_form_finish_batch'
flysystem_config_form_submit in ./flysystem.admin.inc
Submit callback for flysystem_config_form().

File

./flysystem.admin.inc, line 152
Configuration page callbacks for Flysystem.

Code

function _flysystem_config_form_finish_batch($success, array $results, array $operations) {
  if (!$success) {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $operation = reset($operations);
    $args = array(
      '%file' => $operation[2],
    );
    drupal_set_message(t('An error occurred while syncing: %file', $args), 'error');
    return;
  }
  if (empty($results['errors'])) {
    drupal_set_message(t('File synchronization finished successfully.'));
    return;
  }
  foreach ($results['errors'] as $error) {
    if (is_array($error)) {
      drupal_set_message(t($error[0], $error[1]), 'error', TRUE);
      watchdog('flysystem', $error[0], $error[1], WATCHDOG_ERROR);
    }
    else {
      drupal_set_message(check_plain($error), 'error', TRUE);
    }
  }
  drupal_set_message(t('File synchronization experienced errors.'), 'warning');
}