sZipPath = $sZipPath; } function init() { $sTmpPath = tempnam('/tmp', 'zipimportstorage'); if ($sTmpPath === false) { return PEAR::raiseError("Could not create temporary directory for zip storage"); } if (!file_exists($this->sZipPath)) { return PEAR::raiseError("Zip file given does not exist"); } unlink($sTmpPath); mkdir($sTmpPath, 0700); $this->sBasePath = $sTmpPath; $aArgs = array( "unzip", "-q", "-n", "-d", $sTmpPath, $this->sZipPath, ); $sCommand = KTUtil::safeShellString($aArgs); $res = system($sCommand); if ($res === false) { return PEAR::raiseError("Could not retrieve contents from zip storage"); } } function cleanup() { if ($this->sBasePath && file_exists($this->sBasePath)) { // XXX: Only works on Unix-like systems for now. system(KTUtil::safeShellString(array('/bin/rm', '-rf', $this->sBasePath))); $this->sBasePath = null; } } } ?>