From 9a60db8acfc16f307b69cf859717c328b3ac3ec8 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Tue, 27 Oct 2020 11:28:36 +0100
Subject: [PATCH] FEAT #14214 TIME 1:20 Fix first time installer

---
 .../controllers/AuthenticationController.php    | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php
index 80cc5ada761..d480649774e 100755
--- a/src/core/controllers/AuthenticationController.php
+++ b/src/core/controllers/AuthenticationController.php
@@ -725,10 +725,21 @@ class AuthenticationController
             'PUT/installer/administrator', 'DELETE/installer/lock'
         ];
 
-        if (is_file("custom/custom.json")) {
-            return false;
-        } elseif (!in_array($args['route'], $installerRoutes)) {
+        if (!in_array($args['route'], $installerRoutes)) {
             return false;
+        } elseif (is_file("custom/custom.json")) {
+            $customs = scandir('custom');
+            if (count($customs) > 4) {
+                return false;
+            }
+            foreach ($customs as $custom) {
+                if (in_array($custom, ['custom.json', '.', '..'])) {
+                    continue;
+                }
+                if (!is_file("custom/{$custom}/initializing.lck")) {
+                    return false;
+                }
+            }
         }
 
         return true;
-- 
GitLab