Skip to content

Commit

Permalink
Merge branch '11.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Oct 9, 2024
2 parents 0a51531 + cf4bfd6 commit 7cea976
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
18 changes: 16 additions & 2 deletions src/Illuminate/Queue/Console/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function handle()
// connection being run for the queue operation currently being executed.
$queue = $this->getQueue($connection);

if (! $this->hasOption('json') && Terminal::hasSttyAvailable()) {
if (! $this->outputUsingJson() && Terminal::hasSttyAvailable()) {
$this->components->info(
sprintf('Processing jobs from the [%s] %s.', $queue, str('queue')->plural(explode(',', $queue)))
);
Expand Down Expand Up @@ -201,7 +201,7 @@ protected function listenForEvents()
*/
protected function writeOutput(Job $job, $status, Throwable $exception = null)
{
$this->hasOption('json')
$this->outputUsingJson()
? $this->writeOutputAsJson($job, $status, $exception)
: $this->writeOutputForCli($job, $status);
}
Expand Down Expand Up @@ -346,4 +346,18 @@ protected function downForMaintenance()
{
return $this->option('force') ? false : $this->laravel->isDownForMaintenance();
}

/**
* Determine if the worker should output using JSON.
*
* @return bool
*/
protected function outputUsingJson()
{
if (! $this->hasOption('json')) {
return false;
}

return $this->option('json');
}
}
6 changes: 3 additions & 3 deletions src/Illuminate/Support/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,12 @@ public function commands($commands)
/**
* Register commands that should run on "optimize" or "optimize:clear".
*
* @param string $optimize
* @param string $clear
* @param string|null $optimize
* @param string|null $clear
* @param string|null $key
* @return void
*/
protected function optimizes(string $optimize = null, string $clear = null, ?string $key = null)
protected function optimizes(?string $optimize = null, ?string $clear = null, ?string $key = null)
{
$key ??= (string) Str::of(get_class($this))
->classBasename()
Expand Down

0 comments on commit 7cea976

Please sign in to comment.