Skip to content

Commit 1f1baf6

Browse files
committed
added option to limit the number of sites pushed into the update server
1 parent 1894517 commit 1f1baf6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

app/Console/Commands/QueueUpdates.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,22 @@ public function handle(): int
3838

3939
$this->output->writeln('Pushing update jobs');
4040

41-
Site::query()
41+
$sites = Site::query()
4242
->where(
4343
'cms_version',
4444
'like',
4545
$targetVersion[0] . '%'
46-
)
47-
->chunkById(
46+
);
47+
48+
// Query the amount of sites to be updated
49+
$updateCount = $this->ask('How many updates will be pushed? - Use 0 for "ALL"', 100);
50+
51+
if ($updateCount > 0) {
52+
$sites->limit($updateCount);
53+
}
54+
55+
// Chunk and push to queue
56+
$sites->chunkById(
4857
100,
4958
function (Collection $chunk) use ($targetVersion) {
5059
// Show progress

0 commit comments

Comments
 (0)