Use PHP_VERSION constant instead of phpversion() function call
authorChad Horohoe <chadh@wikimedia.org>
Wed, 9 Jul 2014 23:46:35 +0000 (16:46 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Wed, 9 Jul 2014 23:46:35 +0000 (16:46 -0700)
Change-Id: Ifb3d1bd92d6abaa561e7337b311b4cb10c38a2b6

api.php
includes/PHPVersionError.php
includes/api/ApiQuerySiteinfo.php
includes/installer/Installer.php
index.php
load.php
maintenance/install.php
maintenance/update.php
mw-config/index.php
tests/testHelpers.inc

diff --git a/api.php b/api.php
index e55ec75..e8a911e 100644 (file)
--- a/api.php
+++ b/api.php
@@ -34,7 +34,7 @@
 define( 'MW_API', true );
 
 // Bail if PHP is too low
-if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
+if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) {
        // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
        require dirname( __FILE__ ) . '/includes/PHPVersionError.php';
        wfPHPVersionError( 'api.php' );
index e475f0b..0f5a6fc 100644 (file)
@@ -42,7 +42,7 @@ function wfPHPVersionError( $type ) {
        $mwVersion = '1.24';
        $minimumVersionPHP = '5.3.2';
 
-       $phpVersion = phpversion();
+       $phpVersion = PHP_VERSION;
        $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
        $message = "MediaWiki $mwVersion requires at least "
                . "PHP version $minimumVersionPHP, you are using PHP $phpVersion.";
index aacf091..089ce04 100644 (file)
@@ -136,7 +136,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
                $data['generator'] = "MediaWiki {$config->get( 'Version' )}";
 
-               $data['phpversion'] = phpversion();
+               $data['phpversion'] = PHP_VERSION;
                $data['phpsapi'] = PHP_SAPI;
                $data['dbtype'] = $config->get( 'DBtype' );
                $data['dbversion'] = $this->getDB()->getServerVersion();
index 86b975e..4f40693 100644 (file)
@@ -417,7 +417,7 @@ abstract class Installer {
        public function doEnvironmentChecks() {
                // Php version has already been checked by entry scripts
                // Show message here for information purposes
-               $this->showMessage( 'config-env-php', phpversion() );
+               $this->showMessage( 'config-env-php', PHP_VERSION );
 
                $good = true;
                // Must go here because an old version of PCRE can prevent other checks from completing
index bc46111..b35967b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -34,7 +34,7 @@
 # has structures (try/catch, foo()->bar(), etc etc) which throw parse errors in
 # PHP 4. Setup.php and ObjectCache.php have structures invalid in PHP 5.0 and
 # 5.1, respectively.
-if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
+if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) {
        // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
        require dirname( __FILE__ ) . '/includes/PHPVersionError.php';
        wfPHPVersionError( 'index.php' );
index 1790f48..1dd1a89 100644 (file)
--- a/load.php
+++ b/load.php
@@ -23,7 +23,7 @@
  */
 
 // Bail if PHP is too low
-if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
+if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) {
        // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
        require dirname( __FILE__ ) . '/includes/PHPVersionError.php';
        wfPHPVersionError( 'load.php' );
index fbc5d98..3b29452 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Maintenance
  */
 
-if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.3.2' ) < 0 ) ) {
+if ( !function_exists( 'version_compare' ) || ( version_compare( PHP_VERSION, '5.3.2' ) < 0 ) ) {
        require_once dirname( __FILE__ ) . '/../includes/PHPVersionError.php';
        wfPHPVersionError( 'cli' );
 }
index a51564a..046d73c 100755 (executable)
@@ -26,7 +26,7 @@
  * @ingroup Maintenance
  */
 
-if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.3.2' ) < 0 ) ) {
+if ( !function_exists( 'version_compare' ) || ( version_compare( PHP_VERSION, '5.3.2' ) < 0 ) ) {
        require dirname( __FILE__ ) . '/../includes/PHPVersionError.php';
        wfPHPVersionError( 'cli' );
 }
index 9e83c54..be176c7 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 // Bail if PHP is too low
-if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
+if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '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' );
index d2e7f6e..8c24f39 100644 (file)
@@ -318,7 +318,7 @@ class DbTestRecorder extends DbTestPreviewer {
                        array(
                                'tr_date' => $this->db->timestamp(),
                                'tr_mw_version' => $this->version,
-                               'tr_php_version' => phpversion(),
+                               'tr_php_version' => PHP_VERSION,
                                'tr_db_version' => $this->db->getServerVersion(),
                                'tr_uname' => php_uname()
                        ),