From 55bebe0168479074e9df0bff13c684b2110d4304 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 22 Oct 2020 12:14:48 +0200 Subject: [PATCH] Allow returning a Document in ScriptPackageInstallationPlugin --- .../plugin/AbstractPackageInstallationPlugin.class.php | 2 +- .../plugin/ScriptPackageInstallationPlugin.class.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) 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); } /** -- 2.20.1