You are here

protected function CompressionFilter::_gzipDecode in Backup and Migrate 8.4

Gzip decode a file.

Parameters

\BackupMigrate\Core\File\BackupFileReadableInterface $from:

\BackupMigrate\Core\File\BackupFileWritableInterface $to:

Return value

bool

1 call to CompressionFilter::_gzipDecode()
CompressionFilter::beforeRestore in lib/backup_migrate_core/src/Filter/CompressionFilter.php
Run on a restore.

File

lib/backup_migrate_core/src/Filter/CompressionFilter.php, line 228

Class

CompressionFilter
Class CompressionFilter.

Namespace

BackupMigrate\Core\Filter

Code

protected function _gzipDecode(BackupFileReadableInterface $from, BackupFileWritableInterface $to) {
  $success = FALSE;
  if (!$success && function_exists("gzopen")) {
    if ($fp_in = gzopen($from
      ->realpath(), 'rb9')) {
      while (!feof($fp_in)) {
        $to
          ->write(gzread($fp_in, 1024 * 512));
      }
      $success = TRUE;
      gzclose($fp_in);
      $to
        ->close();
    }
  }
  return $success;
}