You are here

function backup_migrate_files_destination_archivesource::get_db in Backup and Migrate 8.3

Same name and namespace in other branches
  1. 6.3 includes/sources.archivesource.inc \backup_migrate_files_destination_archivesource::get_db()
  2. 7.3 includes/sources.archivesource.inc \backup_migrate_files_destination_archivesource::get_db()

Get a database dump to add to the archive.

2 calls to backup_migrate_files_destination_archivesource::get_db()
backup_migrate_files_destination_archivesource::_backup_to_file_cli in includes/sources.archivesource.inc
Backup from this source.
backup_migrate_files_destination_archivesource::_backup_to_file_php in includes/sources.archivesource.inc
Backup from this source.

File

includes/sources.archivesource.inc, line 158
A destination type for saving locally to the server.

Class

backup_migrate_files_destination_archivesource
A destination type for saving locally to the server.

Code

function get_db() {
  backup_migrate_include('destinations', 'files', 'filters', 'profiles');
  $file = new backup_file();
  $settings = _backup_migrate_profile_saved_default_profile();
  $settings->source_id = 'db';
  $settings->filters['compression'] = 'none';
  $file = backup_migrate_filters_backup($file, $settings);

  // Generate a tmp file with the correct final title (because ArchiveTar doesn't seem to allow renaming).
  $tmpdir = backup_migrate_temp_directory();
  $filepath = $tmpdir . '/database.sql';
  rename($file
    ->filepath(), $filepath);
  return $filepath;
}