You are here

public function BackupController::download in Backup and Migrate 8.4

Same name and namespace in other branches
  1. 5.0.x src/Controller/BackupController.php \Drupal\backup_migrate\Controller\BackupController::download()

Download a backup via the browser.

Parameters

\Drupal\backup_migrate\Entity\Destination $backup_migrate_destination:

$backup_id:

1 string reference to 'BackupController::download'
backup_migrate.routing.yml in ./backup_migrate.routing.yml
backup_migrate.routing.yml

File

src/Controller/BackupController.php, line 190

Class

BackupController
Class BackupController.

Namespace

Drupal\backup_migrate\Controller

Code

public function download(Destination $backup_migrate_destination, $backup_id) {
  $destination = $backup_migrate_destination
    ->getObject();
  $file = $destination
    ->getFile($backup_id);
  $file = $destination
    ->loadFileForReading($file);
  $browser = new DrupalBrowserDownloadDestination();
  $browser
    ->saveFile($file);
}