You are here

public static function ScannerConfirmUndoForm::batchFinished in Search and Replace Scanner 8

The batch process has finished.

Parameters

bool $success: Indicates whether the batch process finish successfully.

array $results: Contains the output from the batch operations.

array $operations: A list of operations that were processed.

File

src/Form/ScannerConfirmUndoForm.php, line 111

Class

ScannerConfirmUndoForm
Displayed to confirm that the user want to undo the replace operation.

Namespace

Drupal\scanner\Form

Code

public static function batchFinished($success, $results, $operations) {
  if ($success) {
    $connection = \Drupal::service('database');

    // Set the status of the record to '1', denoting being done.
    $connection
      ->update('scanner')
      ->fields([
      'undone' => 1,
    ])
      ->condition('undo_id', $results['undo_id'], '=')
      ->execute();
  }
  else {
    \Drupal::messenger()
      ->addMessage($this
      ->t('There were some errors.'));
  }
}