public function DirectoryDestination::listFiles in Backup and Migrate 5.0.x
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
\Drupal\backup_migrate\Core\File\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 src/
Core/ Destination/ DirectoryDestination.php - Run a basic query with sort on the list of files.
- DrupalDirectoryDestination::queryFiles in src/
Drupal/ Destination/ DrupalDirectoryDestination.php - Run a basic query with sort on the list of files.
File
- src/
Core/ Destination/ DirectoryDestination.php, line 133
Class
- DirectoryDestination
- @package Drupal\backup_migrate\Core\Destination
Namespace
Drupal\backup_migrate\Core\DestinationCode
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;
}