Example #1
0
 /**
  * Extract a file
  * @param Varien_Object $object
  * @return mixed
  */
 public function decompress(Varien_Object $object)
 {
     $source = $object->getSource();
     $target = $object->getTarget();
     $this->_log($this->_getLog()->__("Decompressing file %s to %s", $source, $target));
     if (!$source || !$target) {
         Mage::throwException($this->_getLog()->__("Source and target must me speficied (source: %s, target %s)", $source, $target));
     }
     $zip = new ZipArchive();
     $zip->open($this->_getFilePath(dirname($source), basename($source)));
     $zip->extractTo($this->_getFilePath(dirname($target), basename($target)));
     $zip->close();
 }