From 72b9ca789c391c84a2fa407baaa9be6a637dbe25 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 18 Dec 2013 18:44:06 +0100 Subject: [PATCH] Fixes template handling during style export Fixes #1595 --- .../files/lib/data/style/StyleEditor.class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index 5de7012b2d..1add0db2cb 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -2,11 +2,13 @@ namespace wcf\data\style; use wcf\data\language\LanguageList; use wcf\data\package\Package; +use wcf\data\package\PackageCache; use wcf\data\template\group\TemplateGroup; use wcf\data\template\group\TemplateGroupAction; use wcf\data\template\TemplateEditor; use wcf\data\DatabaseObjectEditor; use wcf\data\IEditableCachedObject; +use wcf\system\application\ApplicationHandler; use wcf\system\cache\builder\StyleCacheBuilder; use wcf\system\exception\SystemException; use wcf\system\image\ImageHandler; @@ -656,7 +658,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject // append templates to tar // get templates - $sql = "SELECT template.*, package.package, package.packageDir + $sql = "SELECT template.*, package.package FROM wcf".WCF_N."_template template LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = template.packageID) @@ -665,9 +667,17 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject $statement->execute(array($this->templateGroupID)); while ($row = $statement->fetchArray()) { $packageDir = 'com.woltlab.wcf'; - if (!empty($row['packageDir'])) $packageDir = $row['package']; - $filename = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $row['packageDir'] . 'templates/' . $templateGroup->templateGroupFolderName)) . $row['templateName'] . '.tpl'; + if ($row['application'] != 'wcf') { + $application = ApplicationHandler::getInstance()->getApplication($row['application']); + $packageDir = $row['package']; + } + else { + $application = ApplicationHandler::getInstance()->getWCF(); + } + $package = PackageCache::getInstance()->getPackage($application->packageID); + + $filename = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $package->packageDir . 'templates/' . $templateGroup->templateGroupFolderName)) . $row['templateName'] . '.tpl'; $templatesTar->add($filename, $packageDir, dirname($filename)); } -- 2.20.1