Skip to content

Commit

Permalink
Fix acquia#4437: Allow child environment detectors to set non-local
Browse files Browse the repository at this point in the history
Add a new function that custom environment detectors can have return true when a non-local environment is detected.
  • Loading branch information
jedubois committed Jun 3, 2022
1 parent 67324b5 commit c6b49cf
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Robo/Common/EnvironmentDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ public static function isPantheonProdEnv() {
return self::getPantheonEnv() == 'live';
}

/**
* Is 'other' hosting environment.
*
* Allow custom environment detectors to declare a non-local environment.
*/
public static function isOtherHostingEnv() {
$results = self::getSubclassResults(__FUNCTION__);
if ($results) {
return TRUE;
}

return FALSE;
}

/**
* Is local.
*/
Expand All @@ -110,7 +124,7 @@ public static function isLocalEnv() {
return TRUE;
}

return parent::isLocalEnv() && !self::isPantheonEnv() && !self::isCiEnv();
return parent::isLocalEnv() && !self::isPantheonEnv() && !self::isCiEnv() && !self::isOtherHostingEnv();
}

/**
Expand Down

0 comments on commit c6b49cf

Please sign in to comment.