INSTALL: Document requirement for bcmath/gmp on 32-bit systems

GlobalIdGenerator requires one of those unless the system is 64-bit, and
since I72c5e6f86b7f081ab5ce7a56f5365d2f75067a78 that code path is hit on
all page views. Document that requirement and check it during install
time to provide a better experience.

Bug: T391169
Change-Id: I75bcef9eabcfeb92259234a33998b9793be6e08c
(cherry picked from commit 2394bd6366afd63760258206c0ca43aeead7df2b)
This commit is contained in:
Taavi Väänänen 2025-04-18 12:28:36 +03:00 committed by Jforrester
parent db82379f65
commit 20505ef627
2 changed files with 20 additions and 5 deletions

View file

@ -25,6 +25,9 @@ Required software as of MediaWiki 1.43.0:
** PostgreSQL 10 or higher
** SQLite 3.8.0 or higher
In addition, either the bcmath or gmp PHP extension is required on 32-bit
systems.
MediaWiki is developed and tested mainly on Unix/Linux platforms, but should
work on Windows as well.

View file

@ -20,6 +20,7 @@
// phpcs:disable Generic.Arrays.DisallowLongArraySyntax,PSR2.Classes.PropertyDeclaration,MediaWiki.Usage.DirUsage
// phpcs:disable Squiz.Scope.MemberVarScope.Missing,Squiz.Scope.MethodScope.Missing
// phpcs:disable MediaWiki.Usage.StaticClosure.StaticClosure
/**
* Check PHP Version, as well as for composer dependencies in entry points,
* and display something vaguely comprehensible in the event of a totally
@ -186,18 +187,29 @@ HTML;
$missingExtensions = array();
foreach ( $this->functionsExtensionsMapping as $function => $extension ) {
if ( !function_exists( $function ) ) {
$missingExtensions[] = $extension;
$missingExtensions[] = array( $extension );
}
}
// Special case: either of those is required, but only on 32-bit systems (T391169)
if ( PHP_INT_SIZE < 8 && !extension_loaded( 'gmp' ) && !extension_loaded( 'bcmath' ) ) {
$missingExtensions[] = array( 'bcmath', 'gmp' );
}
if ( $missingExtensions ) {
$missingExtText = '';
$missingExtHtml = '';
$baseUrl = 'https://www.php.net';
foreach ( $missingExtensions as $ext ) {
$missingExtText .= " * $ext <$baseUrl/$ext>\n";
$missingExtHtml .= "<li><b>$ext</b> "
. "(<a href=\"$baseUrl/$ext\">more information</a>)</li>";
foreach ( $missingExtensions as $extNames ) {
$plaintextLinks = array();
$htmlLinks = array();
foreach ( $extNames as $ext ) {
$plaintextLinks[] = "$ext <$baseUrl/$ext>";
$htmlLinks[] = "<b>$ext</b> (<a href=\"$baseUrl/$ext\">more information</a>)";
}
$missingExtText .= ' * ' . implode( ' or ', $plaintextLinks ) . "\n";
$missingExtHtml .= "<li>" . implode( ' or ', $htmlLinks ) . "</li>";
}
$cliText = "Error: Missing one or more required PHP extensions. Please see\n"