1 system.tar.inc public Archive_Tar::_openWrite()

Return value

bool

File

core/modules/system/system.tar.inc, line 814

Class

Archive_Tar

Code

public function _openWrite() 
 {
  if ($this->_compress_type == 'gz' && function_exists('gzopen')) {
    $this->_file = @gzopen($this->_tarname, "wb9");
  }
  else {
    if ($this->_compress_type == 'bz2' && function_exists('bzopen')) {
      $this->_file = @bzopen($this->_tarname, "w");
    }
    else {
      if ($this->_compress_type == 'lzma2' && function_exists('xzopen')) {
        $this->_file = @xzopen($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 . ')'
            );
          return false;
        }
      }
    }
  }

  if ($this->_file == 0) {
    $this->_error(
    'Unable to open in write mode \''
      . $this->_tarname . '\''
      );
    return false;
  }

  return true;
}