public function backup_migrate_destination_filesource::_backup_to_file_cli in Backup and Migrate 7.3
Same name and namespace in other branches
- 8.3 includes/sources.filesource.inc \backup_migrate_destination_filesource::_backup_to_file_cli()
- 6.3 includes/sources.filesource.inc \backup_migrate_destination_filesource::_backup_to_file_cli()
Backup from this source.
1 call to backup_migrate_destination_filesource::_backup_to_file_cli()
- backup_migrate_destination_filesource::backup_to_file in includes/
sources.filesource.inc - Backup from this source.
1 method overrides backup_migrate_destination_filesource::_backup_to_file_cli()
- backup_migrate_files_destination_archivesource::_backup_to_file_cli in includes/
sources.archivesource.inc - Backup from this source.
File
- includes/
sources.filesource.inc, line 135 - A destination type for saving locally to the server.
Class
- backup_migrate_destination_filesource
- A destination type for saving locally to the server.
Code
public function _backup_to_file_cli($file, $settings) {
if (!empty($settings->filters['use_cli']) && function_exists('backup_migrate_exec') && function_exists('escapeshellarg')) {
$excluded = $this
->get_excluded_paths($settings);
$exclude = array();
foreach ($excluded as $path) {
$exclude[] = '--exclude=' . escapeshellarg($path);
}
$exclude = implode(' ', $exclude);
// Create a symlink in a temp directory so we can rename the file in the
// archive.
$temp = backup_migrate_temp_directory();
$file
->push_type('tar');
backup_migrate_exec("tar --dereference -C %input -rf %output {$exclude} .", array(
'%output' => $file
->filepath(),
'%input' => $this
->get_realpath(),
'%temp' => $temp,
));
return $file;
}
return FALSE;
}