[dev/core#750] Don't check server variables if we're running in CLI
authorMikey O'Toole <mikey@mjco.uk>
Tue, 16 Jun 2020 10:02:48 +0000 (11:02 +0100)
committerMikey O'Toole <mikey@mjco.uk>
Tue, 16 Jun 2020 10:02:48 +0000 (11:02 +0100)
This PR introduces skipping the server variable checks if we're running in a CLI environment, removing an error when running Drush commands against Drupal 8 and Drupal 9 based sites.
Fix whitespace errors.
Remove variable comment.
Fix more whitespace!

Civi/Install/Requirements.php

index 586a0c75d2de3c2d458e00a97740305cf567c7b1..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;
   }