From f33d887d58e5e0b2619d1a6627709dbfdbbd16eb Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 18 Dec 2013 18:59:04 +0100 Subject: [PATCH] Fixes packageDir in Template objects read via TemplateList Fixes #1594 --- .../lib/data/template/TemplateList.class.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/template/TemplateList.class.php b/wcfsetup/install/files/lib/data/template/TemplateList.class.php index c51d8fc5ca..5938931706 100644 --- a/wcfsetup/install/files/lib/data/template/TemplateList.class.php +++ b/wcfsetup/install/files/lib/data/template/TemplateList.class.php @@ -1,6 +1,8 @@ sqlSelects = 'package.package, package.packageDir, template_group.templateGroupFolderName'; + $this->sqlSelects = 'package.package, template_group.templateGroupFolderName'; $this->sqlJoins = " LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = template.packageID)"; $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_template_group template_group ON (template_group.templateGroupID = template.templateGroupID)"; } + + /** + * @see \wcf\data\DatabaseObjectList::readObjects() + */ + public function readObjects() { + parent::readObjects(); + + foreach ($this->objects as $template) { + if ($template->application != 'wcf') { + $application = ApplicationHandler::getInstance()->getApplication($template->application); + } + else { + $application = ApplicationHandler::getInstance()->getWCF(); + } + $package = PackageCache::getInstance()->getPackage($application->packageID); + + // set directory of the application package the template + // belongs to + $template->packageDir = $package->packageDir; + } + } } -- 2.20.1