function backup_migrate_files_destination_archivesource::_backup_to_file_php in Backup and Migrate 6.3
Same name and namespace in other branches
- 8.3 includes/sources.archivesource.inc \backup_migrate_files_destination_archivesource::_backup_to_file_php()
- 7.3 includes/sources.archivesource.inc \backup_migrate_files_destination_archivesource::_backup_to_file_php()
Backup from this source.
Overrides backup_migrate_destination_filesource::_backup_to_file_php
File
- includes/
sources.archivesource.inc, line 65 - 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 _backup_to_file_php($file, $settings) {
if ($this
->check_libs()) {
$excluded_paths = empty($settings->filters['exclude_filepaths']) ? '' : $settings->filters['exclude_filepaths'];
$exclude = $this
->get_excluded_paths($excluded_paths);
$files = $this
->get_files_to_backup($this
->get_location(), $settings, $exclude, realpath('.') . '/');
if ($files) {
$manifest = $this
->generate_manifest();
$db = $this
->get_db();
$file
->push_type('sitearchive');
$gz = new Archive_Tar($file
->filepath(), false);
$gz
->addModify(array(
$manifest,
), $file->name . '/', dirname($manifest));
$gz
->addModify($files, $file->name . '/docroot', $this
->get_location());
$gz
->addModify($db, $file->name . '/', dirname($db));
unlink($manifest);
rmdir(dirname($manifest));
unlink($db);
rmdir(dirname($db));
return $file;
}
backup_migrate_backup_fail('No files available.', array(), $settings);
return FALSE;
}
return FALSE;
}