From 6a9fc804d4181568abb80a407df622f3afd217fd Mon Sep 17 00:00:00 2001 From: Vladislav Karaulskiy Date: Fri, 26 Mar 2021 20:28:30 +0700 Subject: [PATCH 1/4] Pass the path to a php.ini file to a child process --- src/cli/Command.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/Command.php b/src/cli/Command.php index 886ce8ce62..f9152423b8 100644 --- a/src/cli/Command.php +++ b/src/cli/Command.php @@ -162,9 +162,11 @@ 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, + '-c', + get_cfg_var('cfg_file_path'), $_SERVER['SCRIPT_FILENAME'], $this->uniqueId . '/exec', $id, From d3a54047b0fd7c45b2a5f9913797714b9f5a1002 Mon Sep 17 00:00:00 2001 From: Vladislav Karaulskiy Date: Sun, 28 Mar 2021 20:32:04 +0700 Subject: [PATCH 2/4] Checking if we have a path to an .ini file. CHANGELOG. --- CHANGELOG.md | 2 +- src/cli/Command.php | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df2185ff48..c6b24371cc 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: 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 f9152423b8..264362453f 100644 --- a/src/cli/Command.php +++ b/src/cli/Command.php @@ -162,19 +162,24 @@ public function actionExec($id, $ttr, $attempt, $pid) */ protected function handleMessage($id, $message, $ttr, $attempt) { - // Child process command: php -c yii queue/exec "id" "ttr" "attempt" "pid" + // Child process command: php [-c ] yii queue/exec "id" "ttr" "attempt" "pid" $cmd = [ - $this->phpBinary, - '-c', - get_cfg_var('cfg_file_path'), - $_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; From a78784d944024922f1b1caa3c95fa5f7b2342ee9 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 6 Apr 2021 22:42:09 +0300 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6b24371cc..96fd3432bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii2 Queue Extension Change Log 2.3.2 under development ----------------------- -- Enh: Added path to an `.ini` file to a child process (werdender) +- Enh #412: Added path to an `.ini` file to a child process (werdender) 2.3.1 December 23, 2020 From ec998138251198e8ede102429578c7464f65bab3 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 6 Apr 2021 22:44:54 +0300 Subject: [PATCH 4/4] Update Command.php --- src/cli/Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/Command.php b/src/cli/Command.php index 264362453f..21caa9fea1 100644 --- a/src/cli/Command.php +++ b/src/cli/Command.php @@ -168,7 +168,7 @@ protected function handleMessage($id, $message, $ttr, $attempt) ]; $config = get_cfg_var('cfg_file_path'); - if(is_string($config)) { + if (is_string($config)) { $cmd[] = '-c'; $cmd[] = $config; }