1 bootstrap.inc backup_get_backup_directory()

Get the backup directory (if any) for this site.

This setting comes from $settings['backup_directory'] in settings.php. Note that settings_get('backup_directory') should not be called directly, instead use this function, which takes into account test runs.

This function is in bootstrap.inc so that it can be used without loading backup.inc if backups are not enabled.

@since 1.30.0 Function added.

Return value

string|null: The path to the backup directory, relative or absolute, depending on the site configuration, or NULL if no backup directory is specified.

File

core/includes/bootstrap.inc, line 1465
Functions that need to be loaded on every Backdrop request.

Code

function backup_get_backup_directory() {
  $backup_directory = settings_get('backup_directory');

  // For test runs, specify a specific sub-directory. See BackdropWebTestBase::setUp().
  if ($test_prefix = backdrop_valid_test_ua()) {
    $backup_directory = conf_path() . '/files/simpletest/' . substr($test_prefix, 10) . '/backups';
  }

  return $backup_directory;
}