From: Tim Düsterhus Date: Thu, 22 Oct 2020 10:14:48 +0000 (+0200) Subject: Allow returning a Document in ScriptPackageInstallationPlugin X-Git-Tag: 5.4.0_Alpha_1~583^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=55bebe0168479074e9df0bff13c684b2110d4304;p=GitHub%2FWoltLab%2FWCF.git Allow returning a Document in ScriptPackageInstallationPlugin --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php index 4bd6d6f92a..06c2f94628 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php @@ -67,7 +67,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation // call 'update' event EventHandler::getInstance()->fireAction($this, 'update'); - $this->install(); + return $this->install(); } /** 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 07e371e4c3..dad7215e0d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php @@ -2,6 +2,7 @@ namespace wcf\system\package\plugin; use wcf\system\cache\CacheHandler; use wcf\system\exception\SystemException; +use wcf\system\form\FormDocument; use wcf\system\WCF; use wcf\util\FileUtil; @@ -47,10 +48,10 @@ class ScriptPackageInstallationPlugin extends AbstractPackageInstallationPlugin if ($flushCache) CacheHandler::getInstance()->flushAll(); // run script - $this->run($path.$this->instruction['value']); + $result = $this->run($path.$this->instruction['value']); // delete script - if (@unlink($path.$this->instruction['value'])) { + if (!($result instanceof FormDocument) && @unlink($path.$this->instruction['value'])) { // delete file log entry $sql = "DELETE FROM wcf".WCF_N."_package_installation_file_log WHERE packageID = ? @@ -61,6 +62,8 @@ class ScriptPackageInstallationPlugin extends AbstractPackageInstallationPlugin $this->instruction['value'] ]); } + + return $result; } /** @@ -69,7 +72,7 @@ class ScriptPackageInstallationPlugin extends AbstractPackageInstallationPlugin * @param string $scriptPath */ private function run($scriptPath) { - include($scriptPath); + return include($scriptPath); } /**