You are here

public function ArchiveTar::_openReadWrite in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Archiver/ArchiveTar.php \Drupal\Core\Archiver\ArchiveTar::_openReadWrite()

Return value

bool

1 call to ArchiveTar::_openReadWrite()
ArchiveTar::_openAppend in core/lib/Drupal/Core/Archiver/ArchiveTar.php

File

core/lib/Drupal/Core/Archiver/ArchiveTar.php, line 921

Class

ArchiveTar

Namespace

Drupal\Core\Archiver

Code

public function _openReadWrite() {
  if ($this->_compress_type == 'gz') {
    $this->_file = @gzopen($this->_tarname, "r+b");
  }
  else {
    if ($this->_compress_type == 'bz2') {
      $this
        ->_error('Unable to open bz2 in read/write mode \'' . $this->_tarname . '\' (limitation of bz2 extension)');
      return false;
    }
    else {
      if ($this->_compress_type == 'lzma2') {
        $this
          ->_error('Unable to open lzma2 in read/write mode \'' . $this->_tarname . '\' (limitation of lzma2 extension)');
        return false;
      }
      else {
        if ($this->_compress_type == 'none') {
          $this->_file = @fopen($this->_tarname, "r+b");
        }
        else {
          $this
            ->_error('Unknown or missing compression type (' . $this->_compress_type . ')');
          return false;
        }
      }
    }
  }
  if ($this->_file == 0) {
    $this
      ->_error('Unable to open in read/write mode \'' . $this->_tarname . '\'');
    return false;
  }
  return true;
}