Skip to content

Commit

Permalink
Merge branch 'release/3.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sander-beenen committed Nov 22, 2024
2 parents 5ff4a3d + 8e7b725 commit 973f4a5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Notifications\NotificationServiceProvider;
use Laravel\Horizon\Horizon;
use System\Classes\PluginBase;
use Vdlp\Horizon\Console\ClearQueuesCommand;
use Vdlp\Horizon\Console\InstallCommand;
use Vdlp\Horizon\Console\PushExampleJobsCommand;
use Vdlp\Horizon\ServiceProviders\HorizonServiceProvider;
Expand Down Expand Up @@ -49,6 +50,7 @@ public function boot(): void
$this->registerConsoleCommand(PushExampleJobsCommand::class, PushExampleJobsCommand::class);
}

$this->registerConsoleCommand(ClearQueuesCommand::class, ClearQueuesCommand::class);
$this->registerConsoleCommand(InstallCommand::class, InstallCommand::class);
}

Expand Down
33 changes: 33 additions & 0 deletions console/ClearQueuesCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Vdlp\Horizon\Console;

use Artisan;
use Illuminate\Console\Command;
use Illuminate\Contracts\Config\Repository;

final class ClearQueuesCommand extends Command
{
public function __construct()
{
$this->name = 'vdlp:horizon:clear-queues';
$this->description = 'Clears all the Horizon queues with one command.';

parent::__construct();
}

public function handle(Repository $config): void
{
$supervisors = $config->get('horizon.defaults');

foreach ($supervisors as $supervisor) {
foreach ($supervisor['queue'] as $queue) {
Artisan::call('horizon:clear', ['--queue' => $queue]);

$this->comment(preg_replace('/\R+/', ' ', Artisan::output()));
}
}
}
}
1 change: 1 addition & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ v3.1.0:
v3.1.1: "Update Horizon Dashboard Layout (new UI)"
v3.2.0: "Add support for Horizon 5.24.4"
v3.2.1: "Fix registerMailTemplates for October CMS 3.6"
v3.3.0: "Add console command to clear all the queues"

0 comments on commit 973f4a5

Please sign in to comment.