From ae397847087a0e91663dc8708b6602745afa7ea2 Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Thu, 24 Sep 2015 09:59:45 -0700 Subject: [PATCH] Updated the rebuild:tags command with a progress bar. --- app/Console/Commands/RebuildTags.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/RebuildTags.php b/app/Console/Commands/RebuildTags.php index e379ca6b..46820ec2 100644 --- a/app/Console/Commands/RebuildTags.php +++ b/app/Console/Commands/RebuildTags.php @@ -41,13 +41,21 @@ class RebuildTags extends Command if ($this->argument('trackId')) { $track = Track::findOrFail($this->argument('trackId')); $tracks = [$track]; + } else { - $tracks = Track::whereNotNull('published_at')->get(); + $tracks = Track::whereNotNull('published_at')->orderBy('id', 'asc')->get(); } + $bar = $this->output->createProgressBar(sizeof($tracks)); + foreach($tracks as $track) { $this->comment('Rewriting tags for track #'.$track->id.'...'); $track->updateTags(); + $bar->advance(); + $this->line(''); } + + $bar->finish(); + $this->line(''); } }