public function CompressionFilter::beforeRestore in Backup and Migrate 8.4
Run on a restore.
Parameters
\BackupMigrate\Core\File\BackupFileReadableInterface $file:
Return value
\BackupMigrate\Core\File\BackupFileReadableInterface
File
- lib/
backup_migrate_core/ src/ Filter/ CompressionFilter.php, line 160
Class
- CompressionFilter
- Class CompressionFilter.
Namespace
BackupMigrate\Core\FilterCode
public function beforeRestore(BackupFileReadableInterface $file) {
// If the file is not a supported compression type then simply return the same input file.
$out = $file;
$type = $file
->getExtLast();
switch (strtolower($type)) {
case "gz":
case "gzip":
$out = $this
->getTempFileManager()
->popExt($file);
$this
->_gzipDecode($file, $out);
break;
case "bz":
case "bz2":
case "bzip":
case "bzip2":
$out = $this
->getTempFileManager()
->popExt($file);
$this
->_bzipDecode($file, $out);
break;
case "zip":
$out = $this
->getTempFileManager()
->popExt($file);
$this
->_ZipDecode($file, $out);
break;
}
return $out;
}