You are here

public function DirectoryDestination::listFiles in Backup and Migrate 8.4

Return a list of files from the destination. This list should be date ordered from newest to oldest.

@todo Decide if extended metadata should ALWAYS be loaded here. Is there a use case for getting a list of files WITHOUT metadata?

Return value

BackupFileInterface[] An array of BackupFileInterface objects representing the files with the file ids as keys. The file ids are usually file names but that is up to the implementing destination to decide. The returned files may not be readable. Use loadFileForReading to get a readable file.

Overrides ListableDestinationInterface::listFiles

2 calls to DirectoryDestination::listFiles()
DirectoryDestination::queryFiles in lib/backup_migrate_core/src/Destination/DirectoryDestination.php
Run a basic query with sort on the list of files.
DrupalDirectoryDestination::queryFiles in src/Destination/DrupalDirectoryDestination.php
Run a basic query with sort on the list of files.

File

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

Class

DirectoryDestination
Class ServerDirectoryDestination.

Namespace

BackupMigrate\Core\Destination

Code

public function listFiles() {
  $dir = $this
    ->confGet('directory');
  $out = [];

  // Get the entire list of filenames.
  $files = $this
    ->_getAllFileNames();
  foreach ($files as $file) {
    $filepath = $dir . '/' . $file;
    $out[$file] = new ReadableStreamBackupFile($filepath);
  }
  return $out;
}