diff --git a/app/Core/Bootloader.php b/app/Core/Bootloader.php index fcfdd36be..7281237ae 100644 --- a/app/Core/Bootloader.php +++ b/app/Core/Bootloader.php @@ -302,6 +302,20 @@ private function redirectToInstall(): void } } + /** + * Redirect to update + * + * @return void + */ + private function redirectToUpdate(): void + { + $frontController = $this->app->make(Frontcontroller::class); + + if (! in_array($frontController::getCurrentRoute(), ['install.update', 'api.i18n'])) { + $frontController::redirect(BASE_URL . '/install/update'); + } + } + /** * Check if Leantime is updated * @@ -315,10 +329,12 @@ private function checkIfUpdated(): bool if ($dbVersion == $settingsDbVersion) { $_SESSION['isUpdated'] = true; return true; + } else { + $_SESSION['isUpdated'] = false; } - if (! isset($_GET['update']) && ! isset($_GET['install'])) { - $this->redirectToInstall(); + if (! isset($_GET['act']) || ($_GET['act'] !== "install" && $_GET['act'] !== "install.update")) { + $this->redirectToUpdate(); } return false; diff --git a/app/Domain/Install/Repositories/Install.php b/app/Domain/Install/Repositories/Install.php index a2c355990..e84788f98 100644 --- a/app/Domain/Install/Repositories/Install.php +++ b/app/Domain/Install/Repositories/Install.php @@ -4,6 +4,7 @@ use Exception; use Leantime\Core\AppSettings; + use Leantime\Domain\Setting\Repositories\Setting; use PDO; use Leantime\Domain\Menu\Repositories\Menu as MenuRepository; use PDOException;