From 500ad83af62ff68dbcff0c8d42be9ced0cef9339 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 10 Oct 2024 19:26:56 +0300 Subject: [PATCH] hard rebuild skip confirm --- .../Espo/Core/Console/Commands/Rebuild.php | 16 +++++++++------- .../Resources/metadata/app/consoleCommands.json | 5 ++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/application/Espo/Core/Console/Commands/Rebuild.php b/application/Espo/Core/Console/Commands/Rebuild.php index 19b075a323..729e4c4f63 100644 --- a/application/Espo/Core/Console/Commands/Rebuild.php +++ b/application/Espo/Core/Console/Commands/Rebuild.php @@ -52,16 +52,18 @@ class Rebuild implements Command $this->dataManager->rebuild(); if ($params->hasFlag('hard')) { - $message = - "Are you sure you want to run a hard DB rebuild? It will drop unused columns, " . - "decrease exceeding column lengths. It may take some time to process.\nType [Y] to proceed."; + if (!$params->hasFlag('y')) { + $message = + "Are you sure you want to run a hard DB rebuild? It will drop unused columns, " . + "decrease exceeding column lengths. It may take some time to process.\nType [Y] to proceed."; - $io->writeLine($message); + $io->writeLine($message); - $input = $io->readLine(); + $input = $io->readLine(); - if (strtolower($input) !== 'y') { - return; + if (strtolower($input) !== 'y') { + return; + } } $this->dataManager->rebuildDatabase(null, RebuildMode::HARD); diff --git a/application/Espo/Resources/metadata/app/consoleCommands.json b/application/Espo/Resources/metadata/app/consoleCommands.json index cd035d0231..9a68adbade 100644 --- a/application/Espo/Resources/metadata/app/consoleCommands.json +++ b/application/Espo/Resources/metadata/app/consoleCommands.json @@ -10,7 +10,10 @@ "rebuild": { "listed": true, "noSystemUser": true, - "allowedFlags": ["hard"] + "allowedFlags": [ + "hard", + "y" + ] }, "updateAppTimestamp": { "listed": true,