Indicate the actual version of HHVM in use

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 d09ab9001f.

Change-Id: Ia99dca64779e9c4eaddf5f0e0101674d029b8d55
This commit is contained in:
Kevin Israel 2014-08-03 17:02:45 -04:00
parent 02936f3d95
commit b0751af753
8 changed files with 22 additions and 7 deletions

View 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();

View 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(),

View 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

View 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].",

View 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.",

View 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.

View file

@ -192,7 +192,10 @@
}
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' )

View 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' );