You are here

public function DirectoryDestination::loadFileForReading in Backup and Migrate 5.0.x

Load the file with the given ID from the destination.

Parameters

\Drupal\backup_migrate\Core\File\BackupFileInterface $file:

Return value

\Drupal\backup_migrate\Core\File\BackupFileReadableInterface The file if it exists or NULL if it doesn't.

Overrides ReadableDestinationInterface::loadFileForReading

1 call to DirectoryDestination::loadFileForReading()
DirectoryDestination::deleteTheFile in src/Core/Destination/DirectoryDestination.php
Do the actual delete for a file.

File

src/Core/Destination/DirectoryDestination.php, line 117

Class

DirectoryDestination
@package Drupal\backup_migrate\Core\Destination

Namespace

Drupal\backup_migrate\Core\Destination

Code

public function loadFileForReading(BackupFileInterface $file) {

  // If this file is already readable, simply return it.
  if ($file instanceof BackupFileReadableInterface) {
    return $file;
  }
  $id = $file
    ->getMeta('id');
  if ($this
    ->fileExists($id)) {
    return new ReadableStreamBackupFile($this
      ->idToPath($id));
  }
  return NULL;
}