Allow returning a Document in ScriptPackageInstallationPlugin
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 22 Oct 2020 10:14:48 +0000 (12:14 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 26 Nov 2020 10:43:12 +0000 (11:43 +0100)
wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php

index 4bd6d6f92a12dd1031ad99b89d8c4b57ae6690a0..06c2f94628ea709645ab4a8dc73add65b4651155 100644 (file)
@@ -67,7 +67,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation
                // call 'update' event
                EventHandler::getInstance()->fireAction($this, 'update');
                
-               $this->install();
+               return $this->install();
        }
        
        /**
index 07e371e4c3cf06e4d156b3e20626a6996b7d44d1..dad7215e0d1db1053aa73f1e16af3108d83ab449 100644 (file)
@@ -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);
        }
        
        /**