From 1bbfef7e4f7568b5ac6bf89572c9d54b4d777df9 Mon Sep 17 00:00:00 2001 From: Lee Garrett Date: Sat, 10 Dec 2022 13:15:28 +0100 Subject: [PATCH] Implement occ maintenance:mode --check-if-disabled Signed-off-by: Lee Garrett --- core/Command/Maintenance/Mode.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/Command/Maintenance/Mode.php b/core/Command/Maintenance/Mode.php index c2af33aa4edbf..cf0bdcc520f1e 100644 --- a/core/Command/Maintenance/Mode.php +++ b/core/Command/Maintenance/Mode.php @@ -55,6 +55,12 @@ protected function configure() { null, InputOption::VALUE_NONE, 'disable maintenance mode' + ) + ->addOption( + 'check-if-disabled', + null, + InputOption::VALUE_NONE, + 'return 0 if maintenance mode is disabled, otherwise return 1' ); } @@ -74,6 +80,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int } else { $output->writeln('Maintenance mode already disabled'); } + } elseif ($input->getOption('check-if-disabled')) { + if ($maintenanceMode === false) { + return 0; + } else { + return 1; + } } else { if ($maintenanceMode) { $output->writeln('Maintenance mode is currently enabled');