From fffc606d9ab52fdcc4648d1a9ce84b78aae07557 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 11 Mar 2025 17:06:02 -0700 Subject: [PATCH] Improve output --- app/Console/Commands/FixActionLogTimestamps.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/FixActionLogTimestamps.php b/app/Console/Commands/FixActionLogTimestamps.php index f13d12524e..7e2aa50e30 100644 --- a/app/Console/Commands/FixActionLogTimestamps.php +++ b/app/Console/Commands/FixActionLogTimestamps.php @@ -61,19 +61,25 @@ class FixActionLogTimestamps extends Command return 0; } - foreach ($logs as $log) { - if (!$this->dryrun){ - $this->line(vsprintf('Updating log id:%s from %s to %s', [$log->id, $log->created_at, $log->updated_at])); + if ($this->dryrun) { + $this->info('DRY RUN. NOT ACTUALLY UPDATING LOGS.'); + } + foreach ($logs as $log) { + $this->line(vsprintf('Updating log id:%s from %s to %s', [$log->id, $log->created_at, $log->updated_at])); + + if (!$this->dryrun) { Model::withoutTimestamps(function () use ($log) { $log->created_at = $log->updated_at; $log->saveQuietly(); }); - } else { - $this->line(vsprintf('DRYRUN: Updating log id:%s from %s to %s', [$log->id, $log->created_at, $log->updated_at])); } } + if ($this->dryrun) { + $this->info('DRY RUN. NO CHANGES WERE ACTUALLY MADE.'); + } + return 0; } }