From: Happy-melon
Please consider upgrading your copy of PHP. @@ -160,11 +164,8 @@ $mediaWiki->restInPeace(); * @param $errorMsg String fully-escaped HTML */ function wfDie( $errorMsg ){ - // Use the version set in DefaultSettings if possible, but don't rely on it - global $wgVersion, $wgLogo; - $version = isset( $wgVersion ) && $wgVersion - ? htmlspecialchars( $wgVersion ) - : ''; + global $wgLogo; + $version = htmlspecialchars( MW_VERSION ); $logo = isset( $wgLogo ) && $wgLogo ? $wgLogo : 'http://upload.wikimedia.org/wikipedia/commons/1/1c/MediaWiki_logo.png'; diff --git a/load.php b/load.php index 7fff7c4991..ff6d9d7fef 100644 --- a/load.php +++ b/load.php @@ -30,10 +30,14 @@ function wfDie( $msg = '' ) { die( 1 ); } +// Load global constants, including MW_VERSION and MW_MIN_PHP_VERSION +require_once( dirname( __FILE__ ) . '/includes/Defines.php' ); + // Die on unsupported PHP versions -if( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.2.3' ) < 0 ){ - $version = htmlspecialchars( $wgVersion ); - wfDie( "MediaWiki $version requires at least PHP version 5.2.3." ); +if( !function_exists( 'version_compare' ) || version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ){ + $version = htmlspecialchars( MW_VERSION ); + $phpversion = htmlspecialchars( MW_MIN_PHP_VERSION ); + wfDie( "MediaWiki $version requires at least PHP version $phpversion." ); } require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 9d4da81873..3e3def8f29 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -20,6 +20,9 @@ * @defgroup Maintenance Maintenance */ +// Include global constants, including MW_VERSION and MW_MIN_PHP_VERSION +require_once( dirname( __FILE__ ) . '/includes/Defines.php' ); + // Define this so scripts can easily find doMaintenance.php define( 'RUN_MAINTENANCE_IF_MAIN', dirname( __FILE__ ) . '/doMaintenance.php' ); define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless @@ -27,10 +30,10 @@ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless $maintClass = false; // Make sure we're on PHP5 or better -if ( version_compare( PHP_VERSION, '5.2.3' ) < 0 ) { - die ( "Sorry! This version of MediaWiki requires PHP 5.2.3; you are running " . +if ( version_compare( PHP_VERSION, MW_MIN_PHP_VERSION ) < 0 ) { + die ( "Sorry! This version of MediaWiki requires PHP " . MW_MIN_PHP_VERSION . "; you are running " . PHP_VERSION . ".\n\n" . - "If you are sure you already have PHP 5.2.3 or higher installed, it may be\n" . + "If you are sure you already have PHP " . MW_MIN_PHP_VERSION . " or higher installed, it may be\n" . "installed in a different path from PHP " . PHP_VERSION . ". Check with your system\n" . "administrator.\n" ); } diff --git a/maintenance/install.php b/maintenance/install.php index 57e669d178..6f279f0da3 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -20,9 +20,13 @@ * @see wfWaitForSlaves() */ -if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.2.3' ) < 0 ) ) { - echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.2.3 or higher. ABORTING.\n" . - "Check if you have a newer php executable with a different name, such as php5.\n"; +// Include global constants, including MW_VERSION and MW_MIN_PHP_VERSION +require_once( dirname( __FILE__ ) . '/includes/Defines.php' ); + +if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ) ) { + echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP " . + MW_MIN_PHP_VERSION . " or higher. ABORTING.\n" . + "Check if you have a newer php executable with a different name, such as php5.\n"; die( 1 ); } diff --git a/maintenance/update.php b/maintenance/update.php index ede6ebe4aa..ab695c1849 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -25,8 +25,12 @@ * @ingroup Maintenance */ -if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.2.3' ) < 0 ) ) { - echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.2.3 or higher. ABORTING.\n" . +// Include global constants, including MW_VERSION and MW_MIN_PHP_VERSION +require_once( dirname( __FILE__ ) . '/includes/Defines.php' ); + +if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), MW_MIN_PHP_VERSION ) < 0 ) ) { + echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP " . + MW_MIN_PHP_VERSION . "or higher. ABORTING.\n" . "Check if you have a newer php executable with a different name, such as php5.\n"; die( 1 ); }