You are here

public function backup_migrate_destination::load_files_info in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 includes/destinations.inc \backup_migrate_destination::load_files_info()
  2. 8.3 includes/destinations.inc \backup_migrate_destination::load_files_info()
  3. 6.3 includes/destinations.inc \backup_migrate_destination::load_files_info()
  4. 7.2 includes/destinations.inc \backup_migrate_destination::load_files_info()

Load up the file's metadata from the accompanying .info file if applicable.

1 call to backup_migrate_destination::load_files_info()
backup_migrate_destination::list_files in includes/destinations.inc
List all the available files in the given destination.

File

includes/destinations.inc, line 925

Class

backup_migrate_destination
A base class for creating destinations.

Code

public function load_files_info($files) {
  foreach ($files as $key => $file) {

    // See if there is an info file with the same name as the backup.
    if (isset($files[$key . '.info'])) {
      $info_file = $this
        ->load_file($files[$key . '.info']
        ->file_id());
      $info = drupal_parse_info_file($info_file
        ->filepath());

      // Allow the stored metadata to override the detected metadata.
      unset($info['filename']);
      $file->file_info = $info + $file->file_info;

      // Remove the metadata file from the list.
      unset($files[$key . '.info']);
    }

    // Add destination specific info.
    $file
      ->info_set('destination_id', $this
      ->get('id'));
    $file
      ->info_set('remote', $this
      ->get('remote'));
  }
  return $files;
}