From 0aa0c26fd0cf3bbbd909c3c4959f2d407dcdf6e6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 11 Sep 2023 14:12:40 +0200 Subject: [PATCH] Add a check for legacy multi domain setups --- ...PackageEnableUpgradeOverrideForm.class.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php b/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php index d275a4e290..9497e2109d 100644 --- a/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php @@ -6,6 +6,7 @@ use wcf\data\object\type\ObjectTypeCache; use wcf\data\package\update\server\PackageUpdateServer; use wcf\form\AbstractForm; use wcf\form\AbstractFormBuilderForm; +use wcf\system\application\ApplicationHandler; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\event\EventHandler; use wcf\system\exception\IllegalLinkException; @@ -111,6 +112,7 @@ final class PackageEnableUpgradeOverrideForm extends AbstractFormBuilderForm $this->checkPhpX64(), $this->checkMinimumDatabaseVersion(), $this->checkMysqlNativeDriver(), + $this->checkForAppsWithDifferentDomains(), ]; return \array_filter($issues); @@ -275,6 +277,39 @@ final class PackageEnableUpgradeOverrideForm extends AbstractFormBuilderForm } } + private function checkForAppsWithDifferentDomains(): ?array + { + $usesDifferentDomains = false; + $domainName = ''; + foreach (ApplicationHandler::getInstance()->getApplications() as $application) { + if ($domainName === '') { + $domainName = $application->domainName; + continue; + } + + if ($domainName !== $application->domainName) { + $usesDifferentDomains = true; + break; + } + } + + if (!$usesDifferentDomains) { + return null; + } + + if (WCF::getLanguage()->getFixedLanguageCode() === 'de') { + return [ + 'title' => 'Nutzung mehrerer Domains', + 'description' => 'Der Betrieb von Apps auf unterschiedlichen (Sub-)Domains wird nicht mehr unterstützt.', + ]; + } else { + return [ + 'title' => 'Using multiple domains', + 'description' => 'The support for apps running on different (sub)domains has been discontinued.', + ]; + } + } + /** * @inheritDoc */ -- 2.20.1