From: Matthias Schmidt Date: Wed, 18 Dec 2013 17:59:04 +0000 (+0100) Subject: Fixes packageDir in Template objects read via TemplateList X-Git-Tag: 2.0.1~35 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f33d887d58e5e0b2619d1a6627709dbfdbbd16eb;p=GitHub%2FWoltLab%2FWCF.git Fixes packageDir in Template objects read via TemplateList Fixes #1594 --- 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; + } + } }