acquia / drupal-environment-detector

Provides common methods for detecting the current Acquia environment
GNU General Public License v2.0
10 stars 12 forks source link

DX-5161: Globals Change Causing ACSF Issues #46

Closed mikemadison13 closed 2 years ago

mikemadison13 commented 2 years ago

Several customers have reported that the change introduced here: https://github.com/acquia/drupal-environment-detector/commit/ef6e86df2654f93b11062e07a93dbcd941d65176#diff-0f72aecf0958898efdabd77dc55fb6ce8336a0455ef018ef2a19347553d37e92R199 is causing ACSF to lose detection of the assets on their site. Reverting just these lines via a composer patch similar to the following seems to correct the problem.

diff --git a/src/AcquiaDrupalEnvironmentDetector.php b/src/AcquiaDrupalEnvironmentDetector.php
index 2322ffa..57c4f9d 100644
--- a/src/AcquiaDrupalEnvironmentDetector.php
+++ b/src/AcquiaDrupalEnvironmentDetector.php
@@ -196,9 +196,8 @@ class AcquiaDrupalEnvironmentDetector {
    * @return string|null
    *   ACSF db name.
    */
-  public static function getAcsfDbName(): ?string {
-    $gardens_site_settings = getenv('gardens_site_settings');
-    return is_array($gardens_site_settings) && self::isAcsfEnv() ? $gardens_site_settings['conf']['acsf_db_name'] : NULL;
+  public static function getAcsfDbName() {
+     return isset($GLOBALS['gardens_site_settings']) && self::isAcsfEnv() ? $GLOBALS['gardens_site_settings']['conf']['acsf_db_name'] : NULL;
   }

   /**
mikemadison13 commented 2 years ago

it's unclear to me why getenv wouldn't find/return the same as the $GLOBALS but apparently it is?

johnvolkmer-acquia commented 2 years ago

Just wanted to note that the patch above was successful in resolving the issue for (at least) one ticket.