From 116145ffc37b0cf14858d2876aeea465c5356eaf Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 24 Oct 2013 17:37:45 +0200 Subject: [PATCH] Properly handling script-PIPs for applications --- .../ScriptPackageInstallationPlugin.class.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php index 72be782b8d..0c92ab1005 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php @@ -1,9 +1,9 @@ instruction['attributes']['application'])) { $abbreviation = $this->instruction['attributes']['application']; } else if ($this->installation->getPackage()->isApplication) { - $abbreviation = Package::getAbbreviation($this->installation->getPackage()->package); + $path = FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir); } - $dirConstant = strtoupper($abbreviation) . '_DIR'; - if (!defined($dirConstant)) { - throw new SystemException("Can not execute script-PIP, abbreviation '".$abbreviation."' is unknown"); + if (empty($path)) { + $dirConstant = strtoupper($abbreviation) . '_DIR'; + if (!defined($dirConstant)) { + throw new SystemException("Can not execute script-PIP, abbreviation '".$abbreviation."' is unknown"); + } + + $path = constant($dirConstant); } // reset WCF cache CacheHandler::getInstance()->flushAll(); // run script - $this->run(constant($dirConstant).$this->instruction['value']); + $this->run($path.$this->instruction['value']); // delete script - if (@unlink(constant($dirConstant).$this->instruction['value'])) { + if (@unlink($path.$this->instruction['value'])) { // delete file log entry $sql = "DELETE FROM wcf".WCF_N."_package_installation_file_log WHERE packageID = ? -- 2.20.1