Totally untested/unexecuted/improvised workaround borrowing the technique of https://github.com/symfony/symfony/pull/19053/files -- in short, prepend the command with "export FOO=BAR WHIZ=BANG;"
-
-
Save totten/cf76679b4fabdae4c86e06f8c0988b23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Civi/API/ExternalBatch.php b/Civi/API/ExternalBatch.php | |
index 1ff9282..2e98ad8 100644 | |
--- a/Civi/API/ExternalBatch.php | |
+++ b/Civi/API/ExternalBatch.php | |
@@ -184,6 +184,18 @@ class ExternalBatch { | |
if (!$php) { | |
throw new \CRM_Core_Exception("Failed to locate PHP interpreter."); | |
} | |
+ | |
+ $env = array_merge($this->env, array( | |
+ 'CIVICRM_SETTINGS' => $this->settingsPath, | |
+ )); | |
+ if (!empty($env)) { | |
+ $parts[] = 'export'; | |
+ foreach ($env as $k => $v) { | |
+ $parts[] = escapeshellarg("$k=$v"); | |
+ } | |
+ $parts[] = ';'; | |
+ } | |
+ | |
$parts[] = $php; | |
$parts[] = escapeshellarg($this->root . '/bin/cli.php'); | |
@@ -196,10 +208,7 @@ class ExternalBatch { | |
} | |
$command = implode(" ", $parts); | |
- $env = array_merge($this->env, array( | |
- 'CIVICRM_SETTINGS' => $this->settingsPath, | |
- )); | |
- return new Process($command, $this->root, $env); | |
+ return new Process($command, $this->root); | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment