diff --git a/CHANGELOG.md b/CHANGELOG.md index df2185ff48..96fd3432bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii2 Queue Extension Change Log 2.3.2 under development ----------------------- -- no changes in this release. +- Enh #412: Added path to an `.ini` file to a child process (werdender) 2.3.1 December 23, 2020 diff --git a/src/cli/Command.php b/src/cli/Command.php index 886ce8ce62..21caa9fea1 100644 --- a/src/cli/Command.php +++ b/src/cli/Command.php @@ -162,17 +162,24 @@ public function actionExec($id, $ttr, $attempt, $pid) */ protected function handleMessage($id, $message, $ttr, $attempt) { - // Child process command: php yii queue/exec "id" "ttr" "attempt" "pid" + // Child process command: php [-c ] yii queue/exec "id" "ttr" "attempt" "pid" $cmd = [ - $this->phpBinary, - $_SERVER['SCRIPT_FILENAME'], - $this->uniqueId . '/exec', - $id, - $ttr, - $attempt, - $this->queue->getWorkerPid() ?: 0, + $this->phpBinary ]; + $config = get_cfg_var('cfg_file_path'); + if (is_string($config)) { + $cmd[] = '-c'; + $cmd[] = $config; + } + + $cmd[] = $_SERVER['SCRIPT_FILENAME']; + $cmd[] = $this->uniqueId . '/exec'; + $cmd[] = $id; + $cmd[] = $ttr; + $cmd[] = $attempt; + $cmd[] = $this->queue->getWorkerPid() ?: 0; + foreach ($this->getPassedOptions() as $name) { if (in_array($name, $this->options('exec'), true)) { $cmd[] = '--' . $name . '=' . $this->$name;