Add a check for legacy multi domain setups
authorAlexander Ebert <ebert@woltlab.com>
Mon, 11 Sep 2023 12:12:40 +0000 (14:12 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 11 Sep 2023 12:12:40 +0000 (14:12 +0200)
wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php

index d275a4e290f31ce8a9c6c4fe0bdcc7c8c88e0415..9497e2109d387164e004faa7d167b357d75b0464 100644 (file)
@@ -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
      */