Move install check to autoload runtime template

This commit is contained in:
Jack Anderson 2024-06-25 13:23:48 +01:00 committed by Clemente Raposo
parent f0e2129bdf
commit fb8be46256
2 changed files with 15 additions and 7 deletions

View file

@ -11,14 +11,27 @@ use Symfony\Component\HttpFoundation\Request;
require __DIR__ . '/../config/bootstrap.php';
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
$configValues = $kernel->getConfigValues() ?? [];
$installerLocked = $configValues['installed_locked'] ?? false;
if (!file_exists('legacy/config.php') && !file_exists('../.installed_checked') && !file_exists('../.curl_check_main_page')) {
header('Location: install.php');
if (empty($_POST['install-checked'])) {
header('Location: install.php');
return;
}
file_put_contents('../.installed_checked', true);
header('Location: .');
return;
} else if (!$installerLocked && file_exists('../.installed_checked') && !empty($_POST['install-checked'])) {
header('Location: .');
return;
}
// Get the autoloader class
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$kernel->init();

View file

@ -4,11 +4,6 @@ use App\Kernel;
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
if (!file_exists('legacy/config.php') && !file_exists('../.installed_checked') && !file_exists('../.curl_check_main_page')){
header('Location: install.php');
return;
}
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool)$context['APP_DEBUG']);
};