src/Shell/Task/QueueExecuteTask.php
public function run(array $data, $jobId) {
		$data += [
			'command' => null,
			'params' => [],
			'redirect' => true,
			'escape' => true,
			'accepted' => [static::CODE_SUCCESS],
		];

		if ($data['escape']) {
			$data['command'] = escapeshellcmd($data['command']);
		}

		if ($data['params']) {
			$params = $data['params'];
			if ($data['escape']) {
				foreach ($params as $key => $value) {
					$params[$key] = escapeshellcmd($value);
				}
			}
			$data['command'] .= ' ' . implode(' ', $params);
		}

		$this->out('Executing: `' . $data['command'] . '`');

		$command = $data['command'];
		if ($data['redirect']) {
			$command .= ' 2>&1';
		}

		exec($command, $output, $returnCode);
		$this->nl();
		$this->out($output);

		$acceptedReturnCodes = $data['accepted'];
		$success = !$acceptedReturnCodes || in_array($returnCode, $acceptedReturnCodes, true);
		if (!$success) {
			$this->err('Error (code ' . $returnCode . ')', static::VERBOSE);
		} else {
			$this->success('Success (code ' . $returnCode . ')', static::VERBOSE);
		}

		if (!$success) {
			throw new QueueException('Failed with error code ' . $returnCode . ': `' . $data['command'] . '`');
		}
	}
public function run(array $data, $jobId) {
		$data += [
			'command' => null,
			'params' => [],
			'redirect' => true,
			'escape' => true,
			'accepted' => [static::CODE_SUCCESS],
		];

		if ($data['escape']) {
			$data['command'] = escapeshellcmd($data['command']);
		}

		if ($data['params']) {
			$params = $data['params'];
			if ($data['escape']) {
				foreach ($params as $key => $value) {
					$params[$key] = escapeshellcmd($value);
				}
			}
			$data['command'] .= ' ' . implode(' ', $params);
		}

		$this->out('Executing: `' . $data['command'] . '`');

		$command = $data['command'];
		if ($data['redirect']) {
			$command .= ' 2>&1';
		}

		exec($command, $output, $returnCode);
		$this->nl();
		$this->out($output);

		$acceptedReturnCodes = $data['accepted'];
		$success = !$acceptedReturnCodes || in_array($returnCode, $acceptedReturnCodes, true);
		if (!$success) {
			$this->err('Error (code ' . $returnCode . ')', static::VERBOSE);
		} else {
			$this->success('Success (code ' . $returnCode . ')', static::VERBOSE);
		}

		if (!$success) {
			throw new QueueException('Failed with error code ' . $returnCode . ': `' . $data['command'] . '`');
		}
	}
public function run ( array $ data , $ jobId ) { $ data += [ 'command' => null , 'params' => [ ] , 'redirect' => true , 'escape' => true , 'accepted' => [ static :: CODE_SUCCESS ] , ] ; if ( $ data [ 'escape' ] ) { $ data [ 'command' ] = escapeshellcmd ( $ data [ 'command' ] ) ; } if ( $ data [ 'params' ] ) { $ params = $ data [ 'params' ] ; if ( $ data [ 'escape' ] ) { foreach ( $ params as $ key => $ value ) { $ params [ $ key ] = escapeshellcmd ( $ value ) ; } } $ data [ 'command' ] .= ' ' . implode ( ' ' , $ params ) ; } $ this -> out ( 'Executing: `' . $ data [ 'command' ] . '`' ) ; $ command = $ data [ 'command' ] ; if ( $ data [ 'redirect' ] ) { $ command .= ' 2>&1' ; } exec ( $ command , $ output , $ returnCode ) ; $ this -> nl ( ) ; $ this -> out ( $ output ) ; $ acceptedReturnCodes = $ data [ 'accepted' ] ; $ success = ! $ acceptedReturnCodes || in_array ( $ returnCode , $ acceptedReturnCodes , true ) ; if ( ! $ success ) { $ this -> err ( 'Error (code ' . $ returnCode . ')' , static :: VERBOSE ) ; } else { $ this -> success ( 'Success (code ' . $ returnCode . ')' , static :: VERBOSE ) ; } if ( ! $ success ) { throw new QueueException ( 'Failed with error code ' . $ returnCode . ': `' . $ data [ 'command' ] . '`' ) ; } }
Run function.
This function is executed, when a worker is executing a task.
The return parameter will determine, if the task will be marked completed, or be requeued.

@param array $data The array passed to QueuedJobsTable::createJob()
@param int $jobId The id of the QueuedJob entity
@return void
@throws \Queue\Model\QueueException
Run function . This function is executed when a worker is executing a task . The return parameter will determine if the task will be marked completed or be requeued .