From 49a11f08e9b949ad01aae0896e9cb4af9fb414b3 Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Thu, 8 Feb 2024 01:53:32 +0100 Subject: [PATCH] Improvements to the Install Utilities --- app/Space/InstallUtils.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/Space/InstallUtils.php b/app/Space/InstallUtils.php index 88d0fe8f..4343e561 100644 --- a/app/Space/InstallUtils.php +++ b/app/Space/InstallUtils.php @@ -2,6 +2,7 @@ namespace InvoiceShelf\Space; +use Illuminate\Database\QueryException; use League\Flysystem\FilesystemException; class InstallUtils @@ -13,7 +14,7 @@ class InstallUtils */ public static function isDbCreated() { - return self::tableExists('users'); + return self::dbMarkerExists() && self::tableExists('users'); } /** @@ -30,19 +31,14 @@ class InstallUtils } try { - $flag = self::dbMarkerExists(); - if ($flag) { - $flag &= \Schema::hasTable($table); - } - } catch (\Illuminate\Database\QueryException $e) { - $flag = false; - } catch (\Exception $e) { + $flag = \Schema::hasTable($table); + } catch (QueryException|\Exception $e) { $flag = false; } $cache[$table] = $flag; - return $flag; + return $cache[$table]; } /** @@ -68,7 +64,7 @@ class InstallUtils */ public static function createDbMarker() { - \Storage::disk('local')->put('database_created', 'database_created'); + \Storage::disk('local')->put('database_created', time()); } /**