Skip to content

Commit

Permalink
fix install update
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Sep 21, 2023
1 parent 64ca545 commit f7c0f42
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions app/Core/Bootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions app/Domain/Install/Repositories/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f7c0f42

Please sign in to comment.