From: Kevin Israel Date: Sun, 3 Aug 2014 21:02:45 +0000 (-0400) Subject: Indicate the actual version of HHVM in use X-Git-Tag: 1.31.0-rc.0~14255^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=b0751af7538353fff1bfa41acd09f77dc9f78b4b;p=lhc%2Fweb%2Fwiklou.git 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 d09ab9001ffe. Change-Id: Ia99dca64779e9c4eaddf5f0e0101674d029b8d55 --- diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 30201fc29e..910e28e8f1 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -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(); diff --git a/includes/debug/MWDebug.php b/includes/debug/MWDebug.php index 0cea658908..b878c0e310 100644 --- a/includes/debug/MWDebug.php +++ b/includes/debug/MWDebug.php @@ -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(), diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 7d7741620a..195c5647ff 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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 diff --git a/includes/installer/i18n/en.json b/includes/installer/i18n/en.json index bd76ada1cd..d6e122b3e7 100644 --- a/includes/installer/i18n/en.json +++ b/includes/installer/i18n/en.json @@ -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": "Warning: 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].", diff --git a/includes/installer/i18n/qqq.json b/includes/installer/i18n/qqq.json index 0735574d64..1e5fce5a93 100644 --- a/includes/installer/i18n/qqq.json +++ b/includes/installer/i18n/qqq.json @@ -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.", diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 50929a9ba6..10cc5820f7 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -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. diff --git a/resources/src/mediawiki/mediawiki.debug.js b/resources/src/mediawiki/mediawiki.debug.js index f56f0d9ea1..505a9be399 100644 --- a/resources/src/mediawiki/mediawiki.debug.js +++ b/resources/src/mediawiki/mediawiki.debug.js @@ -192,7 +192,10 @@ } bitDiv( 'phpversion' ) - .append( $( '' ).text( 'PHP' ) ) + .append( $( this.data.phpEngine === 'HHVM' + ? 'HHVM' + : 'PHP' + ) ) .append( ': ' + this.data.phpVersion ); bitDiv( 'time' ) diff --git a/tests/phpunit/includes/debug/MWDebugTest.php b/tests/phpunit/includes/debug/MWDebugTest.php index 17c6224cd9..6e41de7543 100644 --- a/tests/phpunit/includes/debug/MWDebugTest.php +++ b/tests/phpunit/includes/debug/MWDebugTest.php @@ -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' );