public static function ConfigForm::finishBatch in Flysystem 8
Same name and namespace in other branches
- 3.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::finishBatch()
- 2.0.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::finishBatch()
- 3.0.x src/Form/ConfigForm.php \Drupal\flysystem\Form\ConfigForm::finishBatch()
Finish batch.
1 call to ConfigForm::finishBatch()
- ConfigFormTest::testFinishBatch in tests/src/ Unit/ Form/ ConfigFormTest.php 
- @covers ::finishBatch
File
- src/Form/ ConfigForm.php, line 181 
Class
- ConfigForm
- Configure file system settings for this site.
Namespace
Drupal\flysystem\FormCode
public static function finishBatch($success, array $results, array $operations) {
  if (!$success) {
    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $args = [
      '%file' => reset($operations)[2],
    ];
    drupal_set_message(\Drupal::translation()
      ->translate('An error occurred while syncing: %file', $args), 'error');
    return;
  }
  if (empty($results['errors'])) {
    drupal_set_message(\Drupal::translation()
      ->translate('File synchronization finished successfully.'));
    return;
  }
  foreach ($results['errors'] as $error) {
    if (is_array($error)) {
      drupal_set_message(\Drupal::translation()
        ->translate($error[0], $error[1]), 'error', TRUE);
      \Drupal::logger('flysystem')
        ->error($error[0], $error[1]);
    }
    else {
      drupal_set_message(Html::escape($error), 'error', TRUE);
    }
  }
  drupal_set_message(\Drupal::translation()
    ->translate('File synchronization experienced errors.'), 'warning');
}