You are here

public function DirectoryDestination::loadFileForReading in Backup and Migrate 8.4

Load the file with the given ID from the destination.

Parameters

\BackupMigrate\Core\File\BackupFileInterface $file:

Return value

\BackupMigrate\Core\File\BackupFileReadableInterface The file if it exists or NULL if it doesn't

Overrides ReadableDestinationInterface::loadFileForReading

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

File

lib/backup_migrate_core/src/Destination/DirectoryDestination.php, line 115

Class

DirectoryDestination
Class ServerDirectoryDestination.

Namespace

BackupMigrate\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;
}