Beispiel #1
0
 /**
  * Open archive
  *
  * @param string $archive
  * @param bool $create
  * @return bool
  */
 private function open($archive, $create = false)
 {
     if ($this->_enabled) {
         $archive = str_replace('/', '/', $archive);
         if ($create) {
             $this->_archive = $this->_zip->open($archive, ZIPARCHIVE::CREATE);
         } else {
             if (file_exists($archive)) {
                 $this->_archive = $this->_zip->open($archive);
             }
         }
         if ($this->_archive === true) {
             $this->contents();
             return true;
         } else {
             $this->error();
             return false;
         }
     }
     return false;
 }
Beispiel #2
0
 /**
  * Open archive
  *
  * @param string $archive
  * @param bool $create
  * @return bool
  */
 private function open($archive, $create = false)
 {
     if (true === $this->_enabled) {
         $archive = repl('/', DS, $archive);
         if ($create) {
             $this->_archive = $this->_zip->open($archive, \ZipArchive::CREATE);
         } else {
             if (File::exists($archive)) {
                 $this->_archive = $this->_zip->open($archive);
             }
         }
         if ($this->_archive === true) {
             $this->contents();
             return true;
         } else {
             $this->error();
             return false;
         }
     }
     return false;
 }