Taueres has uploaded a new change for review. https://gerrit.wikimedia.org/r/144440
Change subject: Installer: check for low PHP versions ...................................................................... Installer: check for low PHP versions The installer was not checking for unsupported PHP versions. In those cases the script should terminate: the installation process will break. Change-Id: I9227868bd2bd4e13bad6b95ad581be3ada71c94e --- M includes/PHPVersionError.php M mw-config/index.php 2 files changed, 16 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/40/144440/1 diff --git a/includes/PHPVersionError.php b/includes/PHPVersionError.php index 0fb3952..fd0d01e 100644 --- a/includes/PHPVersionError.php +++ b/includes/PHPVersionError.php @@ -32,6 +32,7 @@ * - index.php * - load.php * - api.php + * - mw-config/index.php * - cli * * @note Since we can't rely on anything, the minimum PHP versions and MW current @@ -50,10 +51,16 @@ $finalOutput = "You are using PHP version $phpVersion " . "but MediaWiki $mwVersion needs PHP $minimumVersionPHP or higher. ABORTING.\n" . "Check if you have a newer php executable with a different name, such as php5.\n"; - } elseif ( $type == 'index.php' ) { + } elseif ( $type == 'index.php' || $type == 'mw-config/index.php' ) { $pathinfo = pathinfo( $_SERVER['SCRIPT_NAME'] ); + // Fallback to if statement: ternary operator introduced in PHP 5.3 + if ( $type == 'mw-config/index.php' ) { + $dirname = dirname( $pathinfo['dirname'] ); + } else { + $dirname = $pathinfo['dirname']; + } $encLogo = htmlspecialchars( - str_replace( '//', '/', $pathinfo['dirname'] . '/' ) . + str_replace( '//', '/', $dirname . '/' ) . 'skins/common/images/mediawiki.png' ); diff --git a/mw-config/index.php b/mw-config/index.php index 56c1308..9e83c54 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -20,6 +20,13 @@ * @file */ +// Bail if PHP is too low +if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) { + // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ + require dirname( dirname( __FILE__ ) ) . '/includes/PHPVersionError.php'; + wfPHPVersionError( 'mw-config/index.php' ); +} + define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); define( 'MEDIAWIKI_INSTALL', true ); -- To view, visit https://gerrit.wikimedia.org/r/144440 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9227868bd2bd4e13bad6b95ad581be3ada71c94e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Taueres <santoro....@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits