You are here

protected function DirectoryDestination::checkDirectory in Backup and Migrate 5.0.x

Check that the directory can be used for backup.

Throws

\Drupal\backup_migrate\Core\Exception\BackupMigrateException

3 calls to DirectoryDestination::checkDirectory()
DirectoryDestination::checkWritable in src/Core/Destination/DirectoryDestination.php
DirectoryDestination::saveTheFile in src/Core/Destination/DirectoryDestination.php
Do the actual file save.
DrupalDirectoryDestination::checkDirectory in src/Drupal/Destination/DrupalDirectoryDestination.php
Check that the directory can be used for backup.
1 method overrides DirectoryDestination::checkDirectory()
DrupalDirectoryDestination::checkDirectory in src/Drupal/Destination/DrupalDirectoryDestination.php
Check that the directory can be used for backup.

File

src/Core/Destination/DirectoryDestination.php, line 81

Class

DirectoryDestination
@package Drupal\backup_migrate\Core\Destination

Namespace

Drupal\backup_migrate\Core\Destination

Code

protected function checkDirectory() {
  $dir = $this
    ->confGet('directory');

  // Check if the directory exists.
  if (!file_exists($dir)) {
    throw new DestinationNotWritableException("The backup file could not be saved to '%dir' because it does not exist.", [
      '%dir' => $dir,
    ]);
  }

  // Check if the directory is writable.
  if (!is_writable($this
    ->confGet('directory'))) {
    throw new DestinationNotWritableException("The backup file could not be saved to '%dir' because Backup and Migrate does not have write access to that directory.", [
      '%dir' => $dir,
    ]);
  }
}