Skip to content

Commit

Permalink
Add $id to arguments of run method in example tasks
Browse files Browse the repository at this point in the history
QueueShell::runworker() passes the id of the QueuedTask when it calls
the run method on the task. The QueueLongExampleTask included the
argument but the rest were missing.
  • Loading branch information
houseoftech committed Mar 4, 2015
1 parent 5907258 commit bc2d78e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Console/Command/Task/QueueEmailTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ public function add() {
* QueueEmailTask::run()
*
* @param mixed $data Job data
* @param int $id The id of the QueuedTask
* @return bool Success
*/
public function run($data) {
public function run($data, $id = null) {
if (!isset($data['settings'])) {
$this->err('Queue Email task called without settings data.');
return false;
Expand Down
3 changes: 2 additions & 1 deletion Console/Command/Task/QueueExampleTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ public function add() {
* The return parameter will determine, if the task will be marked completed, or be requeued.
*
* @param array $data The array passed to QueuedTask->createJob()
* @param int $id The id of the QueuedTask
* @return bool Success
*/
public function run($data) {
public function run($data, $id = null) {
$this->hr();
$this->out('CakePHP Queue Example task.');
$this->hr();
Expand Down
3 changes: 2 additions & 1 deletion Console/Command/Task/QueueExecuteTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ public function add() {
* The return parameter will determine, if the task will be marked completed, or be requeued.
*
* @param array $data The array passed to QueuedTask->createJob()
* @param int $id The id of the QueuedTask
* @return bool Success
*/
public function run($data) {
public function run($data, $id = null) {
$command = escapeshellcmd($data['command']);
if (!empty($data['params'])) {
$command .= ' ' . implode(' ', $data['params']);
Expand Down
2 changes: 1 addition & 1 deletion Console/Command/Task/QueueLongExampleTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function add() {
* The return parameter will determine, if the task will be marked completed, or be requeued.
*
* @param array $data The array passed to QueuedTask->createJob()
* @param int $id The id
* @param int $id The id of the QueuedTask
* @return bool Success
* @throws RuntimeException when seconds are 0;
*/
Expand Down
3 changes: 2 additions & 1 deletion Console/Command/Task/QueueRetryExampleTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ public function add() {
* The return parameter will determine, if the task will be marked completed, or be requeued.
*
* @param array $data The array passed to QueuedTask->createJob()
* @param int $id The id of the QueuedTask
* @return bool Success
*/
public function run($data) {
public function run($data, $id = null) {
$count = (int)file_get_contents($this->file);

$this->hr();
Expand Down
3 changes: 2 additions & 1 deletion Console/Command/Task/QueueSuperExampleTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ public function add() {
* The return parameter will determine, if the task will be marked completed, or be requeued.
*
* @param array $data The array passed to QueuedTask->createJob()
* @param int $id The id of the QueuedTask
* @return bool Success
*/
public function run($data) {
public function run($data, $id = null) {
$this->hr();
$this->out('CakePHP Queue SuperExample task.');
$this->hr();
Expand Down

0 comments on commit bc2d78e

Please sign in to comment.