You are here

protected function CompressionFilter::gzipDecode in Backup and Migrate 5.0.x

Gzip decode a file.

Parameters

\Drupal\backup_migrate\Core\File\BackupFileReadableInterface $from:

\Drupal\backup_migrate\Core\File\BackupFileWritableInterface $to:

Return value

bool

1 call to CompressionFilter::gzipDecode()
CompressionFilter::beforeRestore in src/Core/Filter/CompressionFilter.php
Run on a restore.

File

src/Core/Filter/CompressionFilter.php, line 220

Class

CompressionFilter

Namespace

Drupal\backup_migrate\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;
}