function backup_migrate_destination_files::save_file in Backup and Migrate 6.2
File save destination callback.
Overrides backup_migrate_destination::save_file
File
- includes/
destinations.file.inc, line 25 - 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 save_file($file, $settings) {
if ($dir = $this
->get_location()) {
if ($this
->check_dir($dir)) {
$filepath = rtrim($dir, "/") . "/" . $file
->filename();
rename($file
->filepath(), $filepath);
// chmod, chown and chgrp the file if needed.
if ($chmod = $this
->settings('chmod')) {
if (!@chmod($filepath, octdec($chmod))) {
_backup_migrate_message('Unable to set the file mode for: @file', array(
'@file' => $filepath,
), 'error');
}
}
if ($chgrp = $this
->settings('chgrp')) {
if (!@chgrp($filepath, $chgrp)) {
_backup_migrate_message('Unable to set the file group for: @file', array(
'@file' => $filepath,
), 'error');
}
}
return $file;
}
}
}