From: Matthias Schmidt Date: Fri, 11 Jun 2021 14:33:08 +0000 (+0200) Subject: Move developer mode setup into separate method X-Git-Tag: 5.5.0_Alpha_1~649^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1a4deb986554007440972f79b393f0f02e2e621b;p=GitHub%2FWoltLab%2FWCF.git Move developer mode setup into separate method --- diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index ee98ad09be..894519bca4 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -261,58 +261,7 @@ class PackageInstallationDispatcher ); if (WCF::getSession()->getVar('__wcfSetup_developerMode')) { - $statement->execute([ - 1, - 'enable_debug_mode', - ]); - $statement->execute([ - 'public', - 'exception_privacy', - ]); - $statement->execute([ - 'debugFolder', - 'mail_send_method', - ]); - $statement->execute([ - 1, - 'enable_developer_tools', - ]); - $statement->execute([ - 1, - 'log_missing_language_items', - ]); - - foreach (DevtoolsSetup::getInstance()->getOptionOverrides() as $optionName => $optionValue) { - $statement->execute([ - $optionValue, - $optionName, - ]); - } - - foreach (DevtoolsSetup::getInstance()->getUsers() as $newUser) { - try { - (new UserAction([], 'create', [ - 'data' => [ - 'email' => $newUser['email'], - 'password' => $newUser['password'], - 'username' => $newUser['username'], - ], - 'groups' => [ - 1, - 3, - ], - ]))->executeAction(); - } catch (SystemException $e) { - // ignore errors due to event listeners missing at this - // point during installation - } - } - - if (($importPath = DevtoolsSetup::getInstance()->getDevtoolsImportPath()) !== '') { - (new DevtoolsProjectAction([], 'quickSetup', [ - 'path' => $importPath, - ]))->executeAction(); - } + $this->setupDeveloperMode(); } if (WCF::getSession()->getVar('__wcfSetup_imagick')) { @@ -385,6 +334,71 @@ class PackageInstallationDispatcher return $step; } + /** + * @since 5.5 + */ + protected function setupDeveloperMode(): void + { + $sql = "UPDATE wcf" . WCF_N . "_option + SET optionValue = ? + WHERE optionName = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + + $statement->execute([ + 1, + 'enable_debug_mode', + ]); + $statement->execute([ + 'public', + 'exception_privacy', + ]); + $statement->execute([ + 'debugFolder', + 'mail_send_method', + ]); + $statement->execute([ + 1, + 'enable_developer_tools', + ]); + $statement->execute([ + 1, + 'log_missing_language_items', + ]); + + foreach (DevtoolsSetup::getInstance()->getOptionOverrides() as $optionName => $optionValue) { + $statement->execute([ + $optionValue, + $optionName, + ]); + } + + foreach (DevtoolsSetup::getInstance()->getUsers() as $newUser) { + try { + (new UserAction([], 'create', [ + 'data' => [ + 'email' => $newUser['email'], + 'password' => $newUser['password'], + 'username' => $newUser['username'], + ], + 'groups' => [ + 1, + 3, + ], + ]))->executeAction(); + } catch (SystemException $e) { + // ignore errors due to event listeners missing at this + // point during installation + } + } + + $importPath = DevtoolsSetup::getInstance()->getDevtoolsImportPath(); + if ($importPath !== '') { + (new DevtoolsProjectAction([], 'quickSetup', [ + 'path' => $importPath, + ]))->executeAction(); + } + } + /** * Logs an installation step. *