function ArchiveTar::_openWrite

3 calls to ArchiveTar::_openWrite()
ArchiveTar::addString in drupal/core/lib/Drupal/Component/Archiver/ArchiveTar.php
This method add a single string as a file at the end of the existing archive. If the archive does not yet exists it is created.
ArchiveTar::createModify in drupal/core/lib/Drupal/Component/Archiver/ArchiveTar.php
This method creates the archive file and add the files / directories that are listed in $p_filelist. If the file already exists and is writable, it is replaced by the new tar. It is a create and not an add. If the file exists and is read-only or is a…
ArchiveTar::_openAppend in drupal/core/lib/Drupal/Component/Archiver/ArchiveTar.php

File

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

Class

ArchiveTar
Creates a (compressed) Tar archive

Namespace

Drupal\Component\Archiver

Code

function _openWrite() {
  if ($this->_compress_type == 'gz') {
    $this->_file = @gzopen($this->_tarname, "wb9");
  }
  else {
    if ($this->_compress_type == 'bz2') {
      $this->_file = @bzopen($this->_tarname, "w");
    }
    else {
      if ($this->_compress_type == 'none') {
        $this->_file = @fopen($this->_tarname, "wb");
      }
      else {
        $this
          ->_error('Unknown or missing compression type (' . $this->_compress_type . ')');
      }
    }
  }
  if ($this->_file == 0) {
    $this
      ->_error('Unable to open in write mode \'' . $this->_tarname . '\'');
    return false;
  }
  return true;
}