From 40758d475d5069d63a3f39bf6d35140644575bfc Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 11 Sep 2023 15:27:08 +0200 Subject: [PATCH] Add checks for `Memcached` and the attachment storage --- ...PackageEnableUpgradeOverrideForm.class.php | 51 ++++++++++++++++++- .../server/PackageUpdateServer.class.php | 8 +-- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php b/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php index 526ca9e92d..a6fface7d4 100644 --- a/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php @@ -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ützung für einen alternativen Speicherort von Dateianhängen wird mit dem Upgrade entfernt. Es ist notwendig die Dateianhänge in das Standardverzeichnis '%s' zu verschieben und anschließ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 */ diff --git a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php index 118f3559a1..91f1cab09f 100644 --- a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php +++ b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php @@ -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; } -- 2.20.1