From: Tim Düsterhus Date: Wed, 8 Jun 2022 09:07:14 +0000 (+0200) Subject: Configure dynamic options in post_install.php X-Git-Tag: 6.0.0_Alpha_1~1198^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=55cc10da9c1058644b863215d51309009c534885;p=GitHub%2FWoltLab%2FWCF.git Configure dynamic options in post_install.php This simplifies WCFSetup and more importantly PackageInstallationDispatcher. It also removes the useless session variable for the Imagick default status. --- diff --git a/wcfsetup/install/files/acp/post_install.php b/wcfsetup/install/files/acp/post_install.php index 886f4ab405..8e52829df4 100644 --- a/wcfsetup/install/files/acp/post_install.php +++ b/wcfsetup/install/files/acp/post_install.php @@ -5,7 +5,9 @@ use wcf\data\object\type\ObjectTypeCache; use wcf\data\package\PackageCache; use wcf\data\user\UserEditor; use wcf\data\user\UserProfileAction; +use wcf\system\image\adapter\ImagickImageAdapter; use wcf\system\WCF; +use wcf\util\StringUtil; // set default landing page $sql = "UPDATE wcf1_application @@ -80,3 +82,39 @@ $statement->execute([ $this->installation->getPackageID(), 'com.woltlab.wcf.refreshSearchRobots', ]); + +// Configure dynamic option values + +$sql = "UPDATE wcf1_option + SET optionValue = ? + WHERE optionName = ?"; +$statement = WCF::getDB()->prepare($sql); +$statement->execute([ + StringUtil::getUUID(), + 'wcf_uuid', +]); + +if ( + ImagickImageAdapter::isSupported() + && ImagickImageAdapter::supportsAnimatedGIFs(ImagickImageAdapter::getVersion()) + && ImagickImageAdapter::supportsWebp() +) { + $statement->execute([ + 'imagick', + 'image_adapter_type', + ]); +} + +$user = WCF::getUser(); +$statement->execute([ + $user->username, + 'mail_from_name', +]); +$statement->execute([ + $user->email, + 'mail_from_address', +]); +$statement->execute([ + $user->email, + 'mail_admin_address', +]); diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index 1807df4147..1d910eb666 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -1306,14 +1306,9 @@ final class WCFSetup extends WCF $factory = new ACPSessionFactory(); $factory->load(); - $useImagick = ImagickImageAdapter::isSupported() - && ImagickImageAdapter::supportsAnimatedGIFs(ImagickImageAdapter::getVersion()) - && ImagickImageAdapter::supportsWebp(); - SessionHandler::getInstance()->changeUser($admin); SessionHandler::getInstance()->register('__wcfSetup_developerMode', self::$developerMode); SessionHandler::getInstance()->register('__wcfSetup_directories', self::$directories); - SessionHandler::getInstance()->register('__wcfSetup_imagick', $useImagick); SessionHandler::getInstance()->registerReauthentication(); SessionHandler::getInstance()->update(); diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index e294305b31..00be04ee72 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -44,7 +44,6 @@ use wcf\util\CryptoUtil; use wcf\util\FileUtil; use wcf\util\HeaderUtil; use wcf\util\JSON; -use wcf\util\StringUtil; /** * PackageInstallationDispatcher handles the whole installation process. @@ -213,11 +212,6 @@ class PackageInstallationDispatcher WHERE optionName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute([ - StringUtil::getUUID(), - 'wcf_uuid', - ]); - if (\file_exists(WCF_DIR . 'cookiePrefix.txt')) { $statement->execute([ COOKIE_PREFIX, @@ -227,20 +221,6 @@ class PackageInstallationDispatcher @\unlink(WCF_DIR . 'cookiePrefix.txt'); } - $user = new User(1); - $statement->execute([ - $user->username, - 'mail_from_name', - ]); - $statement->execute([ - $user->email, - 'mail_from_address', - ]); - $statement->execute([ - $user->email, - 'mail_admin_address', - ]); - $statement->execute([ // We do not use the cache-timing safe class Hex, because we run the // function during the setup. @@ -266,13 +246,6 @@ class PackageInstallationDispatcher $this->setupDeveloperMode(); } - if (WCF::getSession()->getVar('__wcfSetup_imagick')) { - $statement->execute([ - 'imagick', - 'image_adapter_type', - ]); - } - // update options.inc.php OptionEditor::resetCache();