Add checks for `Memcached` and the attachment storage
authorAlexander Ebert <ebert@woltlab.com>
Mon, 11 Sep 2023 13:27:08 +0000 (15:27 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 11 Sep 2023 13:27:08 +0000 (15:27 +0200)
wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php
wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php

index 526ca9e92d5e979812ea9d03d9457136a6dcaf8d..a6fface7d47a3fc449d4cc8eee29f0d69ae531d5 100644 (file)
@@ -107,7 +107,6 @@ final class PackageEnableUpgradeOverrideForm extends AbstractFormBuilderForm
         EventHandler::getInstance()->fireAction($this, 'getIssuesPreventingUpgrade', $parameters);
 
         $issues = [
-            ...$parameters['issues'],
             $this->checkMinimumPhpVersion(),
             $this->checkMaximumPhpVersion(),
             $this->checkRequiredPhpExtensions(),
@@ -115,6 +114,9 @@ final class PackageEnableUpgradeOverrideForm extends AbstractFormBuilderForm
             $this->checkMinimumDatabaseVersion(),
             $this->checkMysqlNativeDriver(),
             $this->checkForAppsWithDifferentDomains(),
+            $this->checkCacheSourceIsNotMemcached(),
+            $this->checkAttachmentStorage(),
+            ...$parameters['issues'],
         ];
 
         return \array_filter($issues);
@@ -143,7 +145,7 @@ final class PackageEnableUpgradeOverrideForm extends AbstractFormBuilderForm
     private function checkMaximumPhpVersion(): ?array
     {
         // Maximum: PHP 8.3.x
-        if (\PHP_VERSION_ID > 80399) {
+        if (\PHP_VERSION_ID < 80399) {
             return null;
         }
 
@@ -312,6 +314,51 @@ final class PackageEnableUpgradeOverrideForm extends AbstractFormBuilderForm
         }
     }
 
+    private function checkCacheSourceIsNotMemcached(): ?array
+    {
+        if (\CACHE_SOURCE_TYPE !== 'memcached') {
+            return null;
+        }
+
+        if (WCF::getLanguage()->getFixedLanguageCode() === 'de') {
+            return [
+                'title' => 'Eingestellte Unterstützung für Memcached',
+                'description' => 'Memcached wird nicht mehr unterstützt, als Alternative bietet sich die Nutzung von „Redis“ an.',
+            ];
+        } else {
+            return [
+                'title' => 'Discountinued support for Memcached',
+                'description' => 'Memcached is no longer supported, it is recommended to switch to an alternative like “Redis”.',
+            ];
+        }
+    }
+
+    private function checkAttachmentStorage(): ?array
+    {
+
+        if (!\defined('ATTACHMENT_STORAGE') || !ATTACHMENT_STORAGE) {
+            return null;
+        }
+
+        if (WCF::getLanguage()->getFixedLanguageCode() === 'de') {
+            return [
+                'title' => 'Alternativer Speicherort für Dateianhänge',
+                'description' => \sprintf(
+                    "Die Unterst&uuml;tzung f&uuml;r einen alternativen Speicherort von Dateianh&auml;ngen wird mit dem Upgrade entfernt. Es ist notwendig die Dateianh&auml;nge in das Standardverzeichnis '%s' zu verschieben und anschlie&szlig;end die PHP-Konstante 'ATTACHMENT_STORAGE' zu entfernen.",
+                    WCF_DIR . 'attachments/',
+                ),
+            ];
+        } else {
+            return [
+                'title' => 'Alternative storage location for attachments',
+                'description' => \sprintf(
+                    "The support for an alternative attachment storage location will be removed during the upgrade. It is required to move the attachments into the default directory '%s' and then to remove the PHP constant 'ATTACHMENT_STORAGE'.",
+                    WCF_DIR . 'attachments/',
+                ),
+            ];
+        }
+    }
+
     /**
      * @inheritDoc
      */
index 118f3559a1a34744509225e21e7b8c220427f73a..91f1cab09f56c3614c3265dd7a4536d3767a77e0 100644 (file)
@@ -72,10 +72,10 @@ class PackageUpdateServer extends DatabaseObject
         }
 
         if ($this->isWoltLabUpdateServer()) {
-            $this->data['serverURL'] = "http://update.woltlab.com/{$prefix}{$officialPath}/";
+            $this->data['serverURL'] = "https://update.woltlab.com/{$prefix}{$officialPath}/";
         }
         if ($this->isWoltLabStoreServer()) {
-            $this->data['serverURL'] = "http://store.woltlab.com/{$prefix}{$officialPath}/";
+            $this->data['serverURL'] = "https://store.woltlab.com/{$prefix}{$officialPath}/";
         }
         if ($this->isWoltLabUpdateServer() || $this->isWoltLabStoreServer()) {
             $this->data['isDisabled'] = 0;
@@ -123,13 +123,13 @@ class PackageUpdateServer extends DatabaseObject
 
         if (!$woltlabUpdateServer) {
             $packageServer = PackageUpdateServerEditor::create([
-                'serverURL' => "http://update.woltlab.com/{$officialPath}/",
+                'serverURL' => "https://update.woltlab.com/{$officialPath}/",
             ]);
             $results[$packageServer->packageUpdateServerID] = $packageServer;
         }
         if (!$woltlabStoreServer) {
             $packageServer = PackageUpdateServerEditor::create([
-                'serverURL' => "http://store.woltlab.com/{$officialPath}/",
+                'serverURL' => "https://store.woltlab.com/{$officialPath}/",
             ]);
             $results[$packageServer->packageUpdateServerID] = $packageServer;
         }