From: Alexander Ebert Date: Thu, 24 Oct 2013 15:37:45 +0000 (+0200) Subject: Properly handling script-PIPs for applications X-Git-Tag: 2.0.0_Beta_11~16^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=116145ffc37b0cf14858d2876aeea465c5356eaf;p=GitHub%2FWoltLab%2FWCF.git Properly handling script-PIPs for applications --- 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 = ?