You are here

function backup_migrate_destination_files::check_dir in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 8.3 includes/destinations.file.inc \backup_migrate_destination_files::check_dir()
  2. 6.3 includes/destinations.file.inc \backup_migrate_destination_files::check_dir()
  3. 6.2 includes/destinations.file.inc \backup_migrate_destination_files::check_dir()
  4. 7.3 includes/destinations.file.inc \backup_migrate_destination_files::check_dir()
  5. 7.2 includes/destinations.file.inc \backup_migrate_destination_files::check_dir()

Prepare the destination directory for the backups.

1 call to backup_migrate_destination_files::check_dir()
backup_migrate_destination_files::_save_file in includes/destinations.file.inc
File save destination callback.

File

includes/destinations.file.inc, line 176
A destination type for saving locally to the server.

Class

backup_migrate_destination_files
A destination type for saving locally to the server.

Code

function check_dir($directory) {
  if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {

    // Unable to create destination directory.
    _backup_migrate_message("Unable to create or write to the save directory '%directory'. Please check the file permissions that directory and try again.", array(
      '%directory' => $directory,
    ), "error");
    return FALSE;
  }

  // If the destination directory is within the webroot, then secure it as best we can.
  if ($this
    ->dir_in_webroot($directory)) {
    $directory = $this
      ->check_web_dir($directory);
  }
  return $directory;
}