1 backup.database.inc | public BackupDatabase::postBackup(BackupFile &$file) |
Change a file after a backup is complete.
This step is usually used to compress a backup file.
Parameters
BackupFile $file: The file that received the backup. This is explicitly passed by reference to allow it to be reassigned to a new file if needed.
Return value
void:
Overrides Backup::postBackup
File
- core/
includes/ backup/ backup.database.inc, line 245 - Functions to handle the direct to/from database backup source.
Class
- BackupDatabase
- A destination type for saving to a database server.
Code
public function postBackup(BackupFile &$file) {
parent::postBackup($file);
// Compress the backup and delete the original once compressed.
if ($this->settings['compression'] === self::COMPRESSION_GZIP) {
// The returned value should overwrite $file by reference.
$compressed_file = $this->compress($file, self::COMPRESSION_GZIP, TRUE);
if ($compressed_file) {
$file = $compressed_file;
}
else {
$this->log('The backup file could not be compressed. Check that the zlib PHP extension is installed and enough disk space is available.', array(), self::LOG_ERROR);
}
}
}