From: Alexander Ebert Date: Sat, 22 Jun 2024 17:32:11 +0000 (+0200) Subject: Add a preflight script for the upgrade from 6.0 X-Git-Tag: 6.1.0_Alpha_1~48^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9ae20a626b29eeea7697aa73ec438a643b630eb6;p=GitHub%2FWoltLab%2FWCF.git Add a preflight script for the upgrade from 6.0 --- diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.1_checkSystemRequirements.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.1_checkSystemRequirements.php new file mode 100644 index 0000000000..d6521c53f4 --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_6.1_checkSystemRequirements.php @@ -0,0 +1,37 @@ + + * @since 6.1 + */ + +use wcf\system\request\RouteHandler; +use wcf\system\WCF; + +$checkForTls = function () { + if (RouteHandler::secureConnection()) { + return true; + } + + // @see RouteHandler::secureContext() + $host = $_SERVER['HTTP_HOST']; + if ($host === '127.0.0.1' || $host === 'localhost' || \str_ends_with($host, '.localhost')) { + return true; + } + + return false; +}; + +if (!$checkForTls()) { + if (WCF::getLanguage()->getFixedLanguageCode() === 'de') { + $message = "Die Seite wird nicht über HTTPS aufgerufen. Wichtige Funktionen stehen dadurch nicht zur Verfügung, die für die korrekte Funktionsweise der Software erforderlich sind."; + } else { + $message = "The page is not accessed via HTTPS. Important features that are required for the proper operation of the software are therefore not available."; + } + + throw new \RuntimeException($message); +}