sZipPath = $sZipPath; } function init() { $oKTConfig =& KTConfig::getSingleton(); $sBasedir = $oKTConfig->get("urls/tmpDirectory"); $sTmpPath = tempnam($sBasedir, 'zipimportstorage'); if ($sTmpPath === false) { return PEAR::raiseError(_kt("Could not create temporary directory for zip storage")); } if (!file_exists($this->sZipPath)) { return PEAR::raiseError(_kt("Zip file given does not exist")); } unlink($sTmpPath); mkdir($sTmpPath, 0700); $this->sBasePath = $sTmpPath; $sUnzipCommand = KTUtil::findCommand("import/unzip", "unzip"); if (empty($sUnzipCommand)) { return PEAR::raiseError(_kt("unzip command not found on system")); } $aArgs = array( $sUnzipCommand, "-q", "-n", "-d", $sTmpPath, $this->sZipPath, ); $res = KTUtil::pexec($aArgs); if ($res !== 0) { return PEAR::raiseError(_kt("Could not retrieve contents from zip storage")); } } function cleanup() { if ($this->sBasePath && file_exists($this->sBasePath)) { KTUtil::deleteDirectory($this->sBasePath); $this->sBasePath = null; } } } ?>