/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
src/Illuminate/Queue/Console/PauseCommand.php
67 строк
2 KB
Jack Bayliss
[13.x] Add a global pause switch for queues (#61126)
5 часов назад
Не верифицирован
5 часов назад
b3fe92e
Код
Авторство
О чём код?
<?php namespace Illuminate\Queue\Console; use Illuminate\Console\Command; use Illuminate\Contracts\Queue\Factory as QueueManager; use Illuminate\Queue\Console\Concerns\ParsesQueue; use Illuminate\Queue\Worker; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'queue:pause')] class PauseCommand extends Command { use ParsesQueue; /** * The console command name. * * @var string */ protected $signature = 'queue:pause {queue? : The name of the queue to pause} {--all : Pause job processing for all queues on all connections}'; /** * The console command description. * * @var string */ protected $description = 'Pause job processing for a specific queue'; /** * Execute the console command. * * @return int */ public function handle(QueueManager $manager): int { if (! Worker::$pausable) { $this->components->error('Queue pausing is currently disabled.'); return self::FAILURE; } if ($this->option('all')) { $manager->pauseAll(); $this->components->info('Job processing on all queues across all connections has been paused.'); return self::SUCCESS; } if (! $this->argument('queue')) { $this->components->error('A queue name is required unless the --all option is used.'); return self::FAILURE; } [$connection, $queue] = $this->parseQueue($this->argument('queue')); $manager->pause($connection, $queue); $this->components->info("Job processing on queue [{$connection}:{$queue}] has been paused."); return self::SUCCESS; } }