diff --git a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php index 020094c2b0ce..891678003d2b 100755 --- a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -91,7 +91,6 @@ use Illuminate\Notifications\Console\NotificationTableCommand; use Illuminate\Queue\Console\BatchesTableCommand; use Illuminate\Queue\Console\ClearCommand as QueueClearCommand; -use Illuminate\Queue\Console\ContinueCommand as QueueContinueCommand; use Illuminate\Queue\Console\FailedTableCommand; use Illuminate\Queue\Console\FlushFailedCommand as FlushFailedQueueCommand; use Illuminate\Queue\Console\ForgetFailedCommand as ForgetFailedQueueCommand; @@ -148,7 +147,6 @@ class ArtisanServiceProvider extends ServiceProvider implements DeferrableProvid 'PackageDiscover' => PackageDiscoverCommand::class, 'PruneStaleTagsCommand' => PruneStaleTagsCommand::class, 'QueueClear' => QueueClearCommand::class, - 'QueueContinue' => QueueContinueCommand::class, 'QueueFailed' => ListFailedQueueCommand::class, 'QueueFlush' => FlushFailedQueueCommand::class, 'QueueForget' => ForgetFailedQueueCommand::class, diff --git a/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php b/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php new file mode 100644 index 000000000000..6842cec58e0c --- /dev/null +++ b/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php @@ -0,0 +1,21 @@ +laravel['config']['queue.default'], $connection]; + } +} diff --git a/src/Illuminate/Queue/Console/ContinueCommand.php b/src/Illuminate/Queue/Console/ContinueCommand.php deleted file mode 100644 index 78c5f709fa6b..000000000000 --- a/src/Illuminate/Queue/Console/ContinueCommand.php +++ /dev/null @@ -1,73 +0,0 @@ -manager = $manager; - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - [$connection, $queue] = $this->parseQueue($this->argument('queue')); - - $this->manager->resume($connection, $queue); - - $this->components->info("Job processing on queue [{$connection}:{$queue}] has been resumed."); - - return 0; - } - - /** - * Parse the queue argument into connection and queue name. - * - * @param string $queue - * @return array - */ - protected function parseQueue($queue) - { - [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); - - return isset($queue) - ? [$connection, $queue] - : [$this->laravel['config']['queue.default'], $connection]; - } -} diff --git a/src/Illuminate/Queue/Console/PauseCommand.php b/src/Illuminate/Queue/Console/PauseCommand.php index 6997835ce611..8b18c23ee621 100644 --- a/src/Illuminate/Queue/Console/PauseCommand.php +++ b/src/Illuminate/Queue/Console/PauseCommand.php @@ -4,11 +4,14 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Queue\Factory as QueueManager; +use Illuminate\Queue\Console\Concerns\ParsesQueue; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'queue:pause')] class PauseCommand extends Command { + use ParsesQueue; + /** * The console command name. * @@ -23,51 +26,19 @@ class PauseCommand extends Command */ protected $description = 'Pause job processing for a specific queue'; - /** - * The queue manager instance. - * - * @var \Illuminate\Contracts\Queue\Factory - */ - protected $manager; - - /** - * Create a new queue pause command. - */ - public function __construct(QueueManager $manager) - { - parent::__construct(); - - $this->manager = $manager; - } - /** * Execute the console command. * * @return int */ - public function handle() + public function handle(QueueManager $manager) { [$connection, $queue] = $this->parseQueue($this->argument('queue')); - $this->manager->pause($connection, $queue); + $manager->pause($connection, $queue); $this->components->info("Job processing on queue [{$connection}:{$queue}] has been paused."); return 0; } - - /** - * Parse the queue argument into the connection and queue name. - * - * @param string $queue - * @return array - */ - protected function parseQueue($queue) - { - [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); - - return isset($queue) - ? [$connection, $queue] - : [$this->laravel['config']['queue.default'], $connection]; - } } diff --git a/src/Illuminate/Queue/Console/ResumeCommand.php b/src/Illuminate/Queue/Console/ResumeCommand.php index a6c4d478a558..67a0ac69293b 100644 --- a/src/Illuminate/Queue/Console/ResumeCommand.php +++ b/src/Illuminate/Queue/Console/ResumeCommand.php @@ -4,11 +4,14 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Queue\Factory as QueueManager; +use Illuminate\Queue\Console\Concerns\ParsesQueue; use Symfony\Component\Console\Attribute\AsCommand; -#[AsCommand(name: 'queue:resume')] +#[AsCommand(name: 'queue:resume', aliases: ['queue:continue'])] class ResumeCommand extends Command { + use ParsesQueue; + /** * The console command name. * @@ -17,57 +20,32 @@ class ResumeCommand extends Command protected $signature = 'queue:resume {queue : The name of the queue that should resume processing}'; /** - * The console command description. + * The console command name aliases. * - * @var string + * @var list */ - protected $description = 'Resume job processing for a paused queue'; + protected $aliases = ['queue:continue']; /** - * The queue manager instance. + * The console command description. * - * @var \Illuminate\Contracts\Queue\Factory - */ - protected $manager; - - /** - * Create a new queue resume command. + * @var string */ - public function __construct(QueueManager $manager) - { - parent::__construct(); - - $this->manager = $manager; - } + protected $description = 'Resume job processing for a paused queue'; /** * Execute the console command. * * @return int */ - public function handle() + public function handle(QueueManager $manager) { [$connection, $queue] = $this->parseQueue($this->argument('queue')); - $this->manager->resume($connection, $queue); + $manager->resume($connection, $queue); $this->components->info("Job processing on queue [{$connection}:{$queue}] has been resumed."); return 0; } - - /** - * Parse the queue argument into connection and queue name. - * - * @param string $queue - * @return array - */ - protected function parseQueue($queue) - { - [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); - - return isset($queue) - ? [$connection, $queue] - : [$this->laravel['config']['queue.default'], $connection]; - } }