/** * Installs the templates of this package. */ public function install() { parent::install(); // extract files.tar to temp folder $tag = $this->installation->getXMLTag('templates'); $sourceFile = $this->installation->getArchive()->extractTar($tag['cdata'], 'templates_'); // create file handler $fileHandler = new TemplatesFileHandler($this->installation); // extract content of files.tar $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $this->installation->getPackage()->getDir())); try { $fileInstaller = $this->installation->extractFiles($packageDir . 'templates/', $sourceFile, $fileHandler); } catch (SystemException $e) { if (!@file_exists(WCF_DIR . 'acp/templates/packageInstallationFileInstallationFailed.tpl')) { // workaround for wcf 1.0 to 1.1 update throw $e; } else { WCF::getTPL()->assign(array('exception' => $e)); WCF::getTPL()->display('packageInstallationFileInstallationFailed'); exit; } } // look if tpl files are to be overwritten by this update, // and if so, check if these files have been patched before ... require_once WCF_DIR . 'lib/acp/package/plugin/TemplatePatchPackageInstallationPlugin.class.php'; $tar = new Tar($sourceFile); $files = $tar->getContentList(); $templatePatch = new TemplatePatchPackageInstallationPlugin($this->installation); $templatePatch->repatch($files); // delete temporary sourceArchive @unlink($sourceFile); }
/** * Installs the templates of this package. */ public function install() { parent::install(); // extract files.tar to temp folder $tag = $this->installation->getXMLTag('templates'); $sourceFile = $this->installation->getArchive()->extractTar($tag['cdata'], 'templates_'); // create file handler $fileHandler = new TemplatesFileHandler($this->installation); // extract content of files.tar $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $this->installation->getPackage()->getDir())); $fileInstaller = $this->installation->extractFiles($packageDir . 'templates/', $sourceFile, $fileHandler); // look if tpl files are to be overwritten by this update, // and if so, check if these files have been patched before ... require_once WCF_DIR . 'lib/acp/package/plugin/TemplatePatchPackageInstallationPlugin.class.php'; $tar = new Tar($sourceFile); $files = $tar->getContentList(); $templatePatch = new TemplatePatchPackageInstallationPlugin($this->installation); $templatePatch->repatch($files); // delete temporary sourceArchive @unlink($sourceFile); }