A free open source IT asset/license management system
Backup before running updates
Marcus Moore9a8e5bf61e8f
diff --git a/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.php b/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.phpindex 096f8f9e64..694d8d3b30 100644--- a/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.php+++ b/app/Console/Commands/FixBulkAccessoryCheckinActionLogEntries.php@@ -14,7 +14,7 @@ class FixBulkAccessoryCheckinActionLogEntries extends Command** @var string*/- protected $signature = 'snipeit:fix-bulk-accessory-action-log-entries {--dry-run : Run the sync process but don\'t update the database}';+ protected $signature = 'snipeit:fix-bulk-accessory-action-log-entries {--dry-run : Run the sync process but don\'t update the database} {--skip-backup : Skip pre-execution backup}';/*** The console command description.@@ -24,15 +24,15 @@ class FixBulkAccessoryCheckinActionLogEntries extends Commandprotected $description = 'This script attempts to fix timestamps and missing created_by values for bulk checkin entries in the log table';private bool $dryrun = false;+ private bool $skipBackup = false;/*** Execute the console command.*/public function handle(){- if ($this->option('dry-run')) {- $this->dryrun = true;- }+ $this->skipBackup = $this->option('skip-backup');+ $this->dryrun = $this->option('dry-run');if ($this->dryrun) {$this->info('This is a DRY RUN - no changes will be saved.');@@ -71,6 +71,11 @@ class FixBulkAccessoryCheckinActionLogEntries extends Commandreturn 0;}+ if (!$this->dryrun && !$this->skipBackup) {+ $this->info('Backing up the database before making changes...');+ $this->call('snipeit:backup');+ }+if ($this->dryrun) {$this->newLine();$this->info('DRY RUN. NOT ACTUALLY UPDATING LOGS.');