Example #1
0
 /**
  * Unzips a file at a directory level by concatenating ".zip" onto the end of it.
  * <code>
  *  unzip("/path/to/files/themes/mytheme") // will unzip "mytheme.zip"
  * </code>.
  *
  * @param string $directory The base name of the file (without extension, assumed to be in the the temporary directory).
  *
  * @return string Return the full path of the extracted directory.
  */
 protected function unzip($directory)
 {
     $file = $directory . '.zip';
     $zip = new \ZipArchive();
     if ($zip->open($this->f->getTemporaryDirectory() . '/' . $file) === true) {
         $zip->extractTo($this->f->getTemporaryDirectory() . '/' . $directory . '/');
         $zip->close();
         return $this->f->getTemporaryDirectory() . '/' . $directory;
     }
 }