function ArchiveTar::_openReadWrite

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

File

drupal/core/lib/Drupal/Component/Archiver/ArchiveTar.php, line 739

Class

ArchiveTar
Creates a (compressed) Tar archive

Namespace

Drupal\Component\Archiver

Code

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 == 'none') {
        $this->_file = @fopen($this->_tarname, "r+b");
      }
      else {
        $this
          ->_error('Unknown or missing compression type (' . $this->_compress_type . ')');
      }
    }
  }
  if ($this->_file == 0) {
    $this
      ->_error('Unable to open in read/write mode \'' . $this->_tarname . '\'');
    return false;
  }
  return true;
}