Skip to content

Commit 5b5c69b

Browse files
authored
Merge pull request #7330 from christianbeeznest/GH-7224
Install: Fix install redirect when session/DB not ready - refs #7224
2 parents 66145a4 + 226f911 commit 5b5c69b

9 files changed

Lines changed: 529 additions & 165 deletions

File tree

assets/vue/components/installer/Step4.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@
137137
severity="warn"
138138
style="margin-bottom: 8px"
139139
>
140-
<span v-html="t('A database with the same name already exists. It will be deleted.')" />
140+
<span
141+
v-html="
142+
t(
143+
'A database with the same name already exists. If it contains tables, they will be deleted; if it is empty, it will be reused.',
144+
)
145+
"
146+
/>
141147
</Message>
142148

143149
<Message

config/services.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ services:
143143
tags:
144144
- name: security.voter
145145

146+
Chamilo\CoreBundle\EventSubscriber\InstallDbGuardSubscriber:
147+
arguments:
148+
$connection: '@doctrine.dbal.default_connection'
149+
tags:
150+
- { name: kernel.event_subscriber }
151+
146152
Chamilo\CoreBundle\Helpers\ContainerHelper:
147153
calls:
148154
- setAuthorizationChecker: [ '@security.authorization_checker' ]

public/index.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
99

1010
return function (array $context) {
11-
// Chamilo
12-
$isInstalled = $context['APP_INSTALLED'] ?? null;
13-
if (1 !== (int) $isInstalled) {
11+
// Do NOT rely on $context for custom env vars (Runtime may not include them).
12+
$installed = (string) (
13+
$_SERVER['APP_INSTALLED']
14+
?? $_ENV['APP_INSTALLED']
15+
?? getenv('APP_INSTALLED')
16+
?? '0'
17+
);
18+
19+
if ($installed !== '1') {
1420
return new HttpRedirectResponse('./main/install/index.php');
1521
}
1622

0 commit comments

Comments
 (0)