Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 15 additions & 8 deletions src/cli/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PATH_TO_INI_FILE>] 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;
Expand Down