(bug 27781) Pt 2: Check for minimum PHP version in installer (which is seperate from...
[lhc/web/wiklou.git] / includes / installer / Installer.php
index 39ef84d..dfeb414 100644 (file)
@@ -23,6 +23,9 @@
  */
 abstract class Installer {
 
+       // This is the absolute minimum PHP version we can support
+       const MINIMUM_PHP_VERSION = '5.2.0';
+
        /**
         * @var array
         */
@@ -363,14 +366,21 @@ abstract class Installer {
         * @return Status
         */
        public function doEnvironmentChecks() {
-               $this->showMessage( 'config-env-php', phpversion() );
-
-               $good = true;
+               $phpVersion = phpversion();
+               if( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
+                       $this->showMessage( 'config-env-php', $phpVersion );
+                       $good = true;
+               } else {
+                       $this->showMessage( 'config-env-php-toolow', $phpVersion, self::MINIMUM_PHP_VERSION );
+                       $good = false;
+               }
 
-               foreach ( $this->envChecks as $check ) {
-                       $status = $this->$check();
-                       if ( $status === false ) {
-                               $good = false;
+               if( $good ) {
+                       foreach ( $this->envChecks as $check ) {
+                               $status = $this->$check();
+                               if ( $status === false ) {
+                                       $good = false;
+                               }
                        }
                }