From fc009f3d0058028bbbb6418603cf820c0f7cea80 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Tue, 28 Feb 2023 14:26:27 +0000 Subject: [PATCH] revert(install): reset condition to look for instance owner before continuing install --- modules/Install/Controllers/InstallController.php | 4 +++- rector.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/Install/Controllers/InstallController.php b/modules/Install/Controllers/InstallController.php index b9b88922..a6270afe 100644 --- a/modules/Install/Controllers/InstallController.php +++ b/modules/Install/Controllers/InstallController.php @@ -115,8 +115,10 @@ class InstallController extends Controller } try { + $db = db_connect(); + // Check if instance owner has been created, meaning install was completed - if ((new UserModel())->where('is_owner', true) + if ($db->tableExists('users') && (new UserModel())->where('is_owner', true) ->first() !== null ) { // if so, show a 404 page diff --git a/rector.php b/rector.php index e68f37ac..afb6f1bb 100644 --- a/rector.php +++ b/rector.php @@ -11,6 +11,7 @@ use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector; use Rector\Config\RectorConfig; use Rector\Core\ValueObject\PhpVersion; use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector; +use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector; use Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; @@ -64,6 +65,8 @@ return static function (RectorConfig $rectorConfig): void { SymplifyQuoteEscapeRector::class => [__DIR__ . '/app/Language/*', __DIR__ . '/modules/*/Language/*'], NewlineAfterStatementRector::class => [__DIR__ . '/app/Views'], + + ChangeAndIfToEarlyReturnRector::class => [__DIR__ . '/modules/Install/Controllers/InstallController.php'], ]); // Path to phpstan with extensions, that PHPStan in Rector uses to determine types