From f889c1b7093b71fc47f62eee22bc13351dbf356c Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Tue, 19 Nov 2019 15:58:55 +0200
Subject: [PATCH] Prevent maintenance mode from affecting CLI tools. (#1504)

---
 module/VuFind/src/VuFind/Bootstrapper.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/module/VuFind/src/VuFind/Bootstrapper.php b/module/VuFind/src/VuFind/Bootstrapper.php
index 1f4e6063cbf..008b98d1f94 100644
--- a/module/VuFind/src/VuFind/Bootstrapper.php
+++ b/module/VuFind/src/VuFind/Bootstrapper.php
@@ -155,10 +155,9 @@ class Bootstrapper
      */
     protected function initSystemStatus()
     {
-        // If the system is unavailable, forward to a different place:
-        if (isset($this->config->System->available)
-            && !$this->config->System->available
-        ) {
+        // If the system is unavailable and we're not in the console, forward to the
+        // unavailable page.
+        if (!Console::isConsole() && !($this->config->System->available ?? true)) {
             $callback = function ($e) {
                 $routeMatch = new RouteMatch(
                     ['controller' => 'Error', 'action' => 'Unavailable'], 1
-- 
GitLab