Merge pull request #17843 from civicrm/5.28
[civicrm-core.git] / Civi / Install / Requirements.php
index fb61a9966daa2d0226bd0d172e45c2d629797346..d5f3d648ebf242cd23a90146144b54c63c8f7d18 100644 (file)
@@ -28,12 +28,15 @@ class Requirements {
    */
   protected $system_checks = [
     'checkMemory',
-    'checkServerVariables',
     'checkMysqlConnectExists',
     'checkJsonEncodeExists',
     'checkMultibyteExists',
   ];
 
+  protected $system_checks_web = [
+    'checkServerVariables',
+  ];
+
   protected $database_checks = [
     'checkMysqlConnection',
     'checkMysqlVersion',
@@ -83,6 +86,12 @@ class Requirements {
       $errors[] = $this->$check();
     }
 
+    if (PHP_SAPI !== 'cli') {
+      foreach ($this->system_checks_web as $check) {
+        $errors[] = $this->$check();
+      }
+    }
+
     return $errors;
   }
 
@@ -307,7 +316,8 @@ class Requirements {
       return $results;
     }
 
-    if (version_compare($info, $min) == -1) {
+    $versionDetails = mysqli_query($conn, 'SELECT version() as version')->fetch_assoc();
+    if (version_compare($versionDetails['version'], $min) == -1) {
       $results['severity'] = $this::REQUIREMENT_ERROR;
       $results['details'] = "MySQL version is {$info}; minimum required is {$min}";
       return $results;