Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/290070

Change subject: Add hhvm version check
......................................................................

Add hhvm version check

This adds a hhvm version check same as we have one for php.

The minium hhvm version we should be using is 3.6.5 per
https://gerrit.wikimedia.org/r/#/c/263769/

Bug: T123436
Change-Id: I355308b6284ce103e79c27dd5ae3140a1d47990f
---
M includes/PHPVersionCheck.php
1 file changed, 48 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/290070/1

diff --git a/includes/PHPVersionCheck.php b/includes/PHPVersionCheck.php
index 1eafcfa..8f4f078 100644
--- a/includes/PHPVersionCheck.php
+++ b/includes/PHPVersionCheck.php
@@ -33,8 +33,17 @@
        $mwVersion = '1.27';
        $minimumVersionPHP = '5.5.9';
        $phpVersion = PHP_VERSION;
+       $minimumVersionHHVM = '3.6.5';
+       $hhvmVersion = HHVM_VERSION;
 
        if ( !function_exists( 'version_compare' )
+               || version_compare( $phpVersion, $minimumVersionPHP ) < 0
+               && version_compare( $hhvmVersion, $minimumVersionHHVM ) < 0
+       ) {
+               wfHHVMVersionError(
+                       $entryPoint, $mwVersion, $minimumVersionPHP, 
$phpVersion, $minimumVersionHHVM, $hhvmVersion
+               );
+       } elseif ( !function_exists( 'version_compare' )
                || version_compare( $phpVersion, $minimumVersionPHP ) < 0
        ) {
                wfPHPVersionError( $entryPoint, $mwVersion, $minimumVersionPHP, 
$phpVersion );
@@ -176,6 +185,45 @@
 }
 
 /**
+ * Display an error for the minimum PHP and HHVM version requirement not being 
satisfied.
+ *
+ * @param string $type See wfGenericError
+ * @param string $mwVersion See wfGenericError
+ * @param string $minimumVersionPHP The minimum PHP version supported by 
MediaWiki
+ * @param string $phpVersion The current PHP version
+ * @param string $minimumVersionHHVM The minimum HHVM version supported by 
MediaWiki
+ * @param string $hhvmVersion The current HHVM version
+ */
+function wfHHVMVersionError(
+       $type, $mwVersion, $minimumVersionPHP, $phpVersion, 
$minimumVersionHHVM, $hhvmVersion
+) {
+       $shortText = "MediaWiki $mwVersion requires at least "
+               . "PHP version $minimumVersionPHP and HHVM version 
$minimumVersionHHVM,
+                       you are using PHP $phpVersion and HHVM $hhvmVersion.";
+
+       $longText = "Error: You might be using on older PHP version. \n"
+               . "MediaWiki $mwVersion needs PHP $minimumVersionPHP and HHVM 
$minimumVersionHHVM or higher.\n\n"
+               . "Check if you have a newer php executable with a different 
name, such as php5.\n\n";
+
+       $longHtml = <<<HTML
+                       Please consider <a 
href="http://www.php.net/downloads.php";>upgrading your copy of PHP</a>.
+                       PHP versions less than 5.5.0 are no longer supported by 
the PHP Group and will not receive
+                       security or bugfix updates.
+
+                       Also please consider upgrading <a 
href="https://docs.hhvm.com/hhvm/installation/introduction";>
+                       upgrading your copy of HHVM</a>
+               </p>
+               <p>
+                       If for some reason you are unable to upgrade your PHP 
version, you will need to
+                       <a 
href="https://www.mediawiki.org/wiki/Download";>download</a> an older version
+                       of MediaWiki from our website.  See our
+                       <a 
href="https://www.mediawiki.org/wiki/Compatibility#PHP";>compatibility page</a>
+                       for details of which versions are compatible with prior 
versions of PHP.
+HTML;
+       wfGenericError( $type, $mwVersion, 'Supported PHP and HHVM versions', 
$shortText, $longText, $longHtml );
+}
+
+/**
  * Display an error for the vendor/autoload.php file not being found.
  *
  * @param string $type See wfGenericError

-- 
To view, visit https://gerrit.wikimedia.org/r/290070
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I355308b6284ce103e79c27dd5ae3140a1d47990f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to