You are here

public function DrupalDirectoryDestination::saveTheFile in Backup and Migrate 5.0.x

Do the actual file save.

This function is called to save the data file AND the metadata sidecar file.

Parameters

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

Throws

\Drupal\backup_migrate\Core\Exception\BackupMigrateException

Overrides DirectoryDestination::saveTheFile

File

src/Drupal/Destination/DrupalDirectoryDestination.php, line 29

Class

DrupalDirectoryDestination
@package Drupal\backup_migrate\Drupal\Destination

Namespace

Drupal\backup_migrate\Drupal\Destination

Code

public function saveTheFile(BackupFileReadableInterface $file) {

  // Check if the directory exists.
  $this
    ->checkDirectory();
  try {
    \Drupal::service('file_system')
      ->move($file
      ->realpath(), $this
      ->idToPath($file
      ->getFullName()), FileSystemInterface::EXISTS_REPLACE);
  } catch (FileException $e) {
    return FALSE;
  }
}