Indicate the actual version of HHVM in use
authorKevin Israel <pleasestand@live.com>
Sun, 3 Aug 2014 21:02:45 +0000 (17:02 -0400)
committerKevin Israel <pleasestand@live.com>
Tue, 5 Aug 2014 20:36:47 +0000 (16:36 -0400)
Strings like "5.6.99-hhvm" are not version numbers but merely
a way for HHVM to pass version checks. They should not be
displayed in the UI.

This affects Special:Version, the API (action=query&meta=siteinfo),
the installer welcome page, and the debug toolbar.

Follows-up d09ab9001ffe.

Change-Id: Ia99dca64779e9c4eaddf5f0e0101674d029b8d55

includes/api/ApiQuerySiteinfo.php
includes/debug/MWDebug.php
includes/installer/Installer.php
includes/installer/i18n/en.json
includes/installer/i18n/qqq.json
includes/specials/SpecialVersion.php
resources/src/mediawiki/mediawiki.debug.js
tests/phpunit/includes/debug/MWDebugTest.php

index 30201fc..910e28e 100644 (file)
@@ -138,6 +138,9 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
                $data['phpversion'] = PHP_VERSION;
                $data['phpsapi'] = PHP_SAPI;
+               if ( defined( 'HHVM_VERSION' ) ) {
+                       $data['hhvmversion'] = HHVM_VERSION;
+               }
                $data['dbtype'] = $config->get( 'DBtype' );
                $data['dbversion'] = $this->getDB()->getServerVersion();
 
index 0cea658..b878c0e 100644 (file)
@@ -539,7 +539,8 @@ class MWDebug {
 
                return array(
                        'mwVersion' => $wgVersion,
-                       'phpVersion' => PHP_VERSION,
+                       'phpEngine' => wfIsHHVM() ? 'HHVM' : 'PHP',
+                       'phpVersion' => wfIsHHVM() ? HHVM_VERSION : PHP_VERSION,
                        'gitRevision' => GitInfo::headSHA1(),
                        'gitBranch' => GitInfo::currentBranch(),
                        'gitViewUrl' => GitInfo::headViewUrl(),
index 7d77416..195c564 100644 (file)
@@ -434,7 +434,11 @@ 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', PHP_VERSION );
+               if ( wfIsHHVM() ) {
+                       $this->showMessage( 'config-env-hhvm', HHVM_VERSION );
+               } else {
+                       $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 bd76ada..d6e122b 100644 (file)
@@ -44,6 +44,7 @@
        "config-env-good": "The environment has been checked.\nYou can install MediaWiki.",
        "config-env-bad": "The environment has been checked.\nYou cannot install MediaWiki.",
        "config-env-php": "PHP $1 is installed.",
+       "config-env-hhvm": "HHVM $1 is installed.",
        "config-unicode-using-utf8": "Using Brion Vibber's utf8_normalize.so for Unicode normalization.",
        "config-unicode-using-intl": "Using the [http://pecl.php.net/intl intl PECL extension] for Unicode normalization.",
        "config-unicode-pure-php-warning": "<strong>Warning:</strong> The [http://pecl.php.net/intl intl PECL extension] is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.\nIf you run a high-traffic site, you should read a little on [//www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations Unicode normalization].",
index 0735574..1e5fce5 100644 (file)
@@ -62,6 +62,7 @@
        "config-env-good": "See also:\n* {{msg-mw|Config-env-bad}}",
        "config-env-bad": "See also:\n* {{msg-mw|Config-env-good}}",
        "config-env-php": "Parameters:\n* $1 - the version of PHP that has been installed\nSee also:\n* {{msg-mw|config-env-php-toolow}}",
+       "config-env-hhvm": "Parameters:\n* $1 - the version of HHVM that has been installed",
        "config-unicode-using-utf8": "Status message in the MediaWiki installer environment checks.",
        "config-unicode-using-intl": "Status message in the MediaWiki installer environment checks.",
        "config-unicode-pure-php-warning": "PECL is the name of a group producing standard pieces of software for PHP, and intl is the name of their library handling some aspects of internationalization.",
index 50929a9..10cc582 100644 (file)
@@ -211,9 +211,11 @@ class SpecialVersion extends SpecialPage {
                // wikimarkup can be used.
                $software = array();
                $software['[https://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
-               $phpKey = wfIsHHVM() ? '[http://hhvm.com/ HHVM]' :
-                       '[https://php.net/ PHP]';
-               $software[$phpKey] = PHP_VERSION . " (" . PHP_SAPI . ")";
+               if ( wfIsHHVM() ) {
+                       $software['[http://hhvm.com/ HHVM]'] = HHVM_VERSION . " (" . PHP_SAPI . ")";
+               } else {
+                       $software['[https://php.net/ PHP]'] = PHP_VERSION . " (" . PHP_SAPI . ")";
+               }
                $software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
 
                // Allow a hook to add/remove items.
index f56f0d9..505a9be 100644 (file)
                        }
 
                        bitDiv( 'phpversion' )
-                               .append( $( '<a href="//www.php.net/"></a>' ).text( 'PHP' ) )
+                               .append( $( this.data.phpEngine === 'HHVM'
+                                       ? '<a href="http://hhvm.com/">HHVM</a>'
+                                       : '<a href="https://php.net/">PHP</a>'
+                               ) )
                                .append( ': ' + this.data.phpVersion );
 
                        bitDiv( 'time' )
index 17c6224..6e41de7 100644 (file)
@@ -103,7 +103,7 @@ class MWDebugTest extends MediaWikiTestCase {
                $this->assertInstanceOf( 'ApiResult', $result );
                $data = $result->getData();
 
-               $expectedKeys = array( 'mwVersion', 'phpVersion', 'gitRevision', 'gitBranch',
+               $expectedKeys = array( 'mwVersion', 'phpEngine', 'phpVersion', 'gitRevision', 'gitBranch',
                        'gitViewUrl', 'time', 'log', 'debugLog', 'queries', 'request', 'memory',
                        'memoryPeak', 'includes', 'profile', '_element' );