You are here

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

BZip 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::bzipDecode()
CompressionFilter::beforeRestore in src/Core/Filter/CompressionFilter.php
Run on a restore.

File

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

Class

CompressionFilter

Namespace

Drupal\backup_migrate\Core\Filter

Code

protected function bzipDecode(BackupFileReadableInterface $from, BackupFileWritableInterface $to) {
  $success = FALSE;
  if (!$success && function_exists("bzopen")) {
    if ($fp_in = bzopen($from
      ->realpath(), 'r')) {
      while (!feof($fp_in)) {
        $to
          ->write(bzread($fp_in, 1024 * 512));
      }
      $success = TRUE;
      bzclose($fp_in);
      $to
        ->close();
    }
  }
  return $success;
}