From: Tim Düsterhus Date: Fri, 29 Sep 2023 09:18:10 +0000 (+0200) Subject: Reset OPcache after writing an updated bootstrap loader X-Git-Tag: 6.0.0~38 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d92c97d1ea32f99786b307a6700eedf04ad4f19;p=GitHub%2FWoltLab%2FWCF.git Reset OPcache after writing an updated bootstrap loader --- diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 4b6ccd6bbb..d70dd3f422 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -177,6 +177,8 @@ class WCF */ protected static $zendOpcacheEnabled; + public const BOOTSTRAP_LOADER = \WCF_DIR . '/lib/bootstrap.php'; + /** * Calls all init functions of the WCF class. */ @@ -207,14 +209,14 @@ class WCF final protected function runBootstrappers(): void { try { - $bootstrappers = require(\WCF_DIR . 'lib/bootstrap.php'); + $bootstrappers = require(self::BOOTSTRAP_LOADER); } catch (\Exception $e) { \wcf\functions\exception\logThrowable($e); $command = new RebuildBootstrapper(); $command(); - $bootstrappers = require(\WCF_DIR . 'lib/bootstrap.php'); + $bootstrappers = require(self::BOOTSTRAP_LOADER); } foreach ($bootstrappers as $bootstrapper) { diff --git a/wcfsetup/install/files/lib/system/package/command/RebuildBootstrapper.class.php b/wcfsetup/install/files/lib/system/package/command/RebuildBootstrapper.class.php index 72a70456bc..4644ef3118 100644 --- a/wcfsetup/install/files/lib/system/package/command/RebuildBootstrapper.class.php +++ b/wcfsetup/install/files/lib/system/package/command/RebuildBootstrapper.class.php @@ -5,6 +5,7 @@ namespace wcf\system\package\command; use wcf\data\package\Package; use wcf\data\package\PackageList; use wcf\system\io\AtomicWriter; +use wcf\system\WCF; /** * Rebuilds the bootstrapping script. @@ -67,9 +68,11 @@ final class RebuildBootstrapper EOT; $result .= "\n"; - $writer = new AtomicWriter(\WCF_DIR . 'lib/bootstrap.php'); + $writer = new AtomicWriter(WCF::BOOTSTRAP_LOADER); $writer->write($result); $writer->flush(); + + WCF::resetZendOpcache(WCF::BOOTSTRAP_LOADER); } private function bootstrapExists(Package $package): bool