public function CompressionFilter::beforeRestore in Backup and Migrate 5.0.x
Run on a restore.
Parameters
\Drupal\backup_migrate\Core\File\BackupFileReadableInterface $file:
Return value
\Drupal\backup_migrate\Core\File\BackupFileReadableInterface
File
- src/
Core/ Filter/ CompressionFilter.php, line 153
Class
Namespace
Drupal\backup_migrate\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;
}