From 54625ccc41269790092923a5abd05cd9fb85aa64 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 10 Jul 2024 11:04:17 +0300 Subject: [PATCH 1/2] Improve selfhost app load time --- app/Http/Controllers/SetupController.php | 4 ++-- app/Utils/SystemHealth.php | 4 ++-- app/Utils/Traits/AppSetup.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index eadc26b0fd74..fe0fad23a324 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -43,7 +43,7 @@ class SetupController extends Controller public function index() { - $check = SystemHealth::check(false); + $check = SystemHealth::check(false, false); if ($check['system_health'] == true && $check['simple_db_check'] && Schema::hasTable('accounts') && $account = Account::first()) { return redirect('/'); @@ -59,7 +59,7 @@ class SetupController extends Controller public function doSetup(StoreSetupRequest $request) { try { - $check = SystemHealth::check(false); + $check = SystemHealth::check(false, false); } catch (Exception $e) { nlog(['message' => $e->getMessage(), 'action' => 'SetupController::doSetup()']); diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 46aac5fa4abb..aed67aaae11a 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -43,7 +43,7 @@ class SystemHealth * @param bool $check_database * @return array Result set of checks */ - public static function check($check_database = true): array + public static function check($check_database = true, $check_filesystem = true): array { $system_health = true; @@ -82,7 +82,7 @@ class SystemHealth 'pdf_engine' => (string) self::getPdfEngine(), 'queue' => (string) config('queue.default'), 'trailing_slash' => (bool) self::checkUrlState(), - 'file_permissions' => (string) self::checkFileSystem(), + 'file_permissions' => (string) ($check_filesystem ? self::checkFileSystem() : ''), 'exchange_rate_api_not_configured' => (bool)self::checkCurrencySanity(), 'api_version' => (string) config('ninja.app_version'), 'is_docker' => (bool) config('ninja.is_docker'), diff --git a/app/Utils/Traits/AppSetup.php b/app/Utils/Traits/AppSetup.php index bd39635136f6..00c656e7861f 100644 --- a/app/Utils/Traits/AppSetup.php +++ b/app/Utils/Traits/AppSetup.php @@ -25,7 +25,7 @@ trait AppSetup return Ninja::isNinja(); } - $check = SystemHealth::check(); + $check = SystemHealth::check(true, false); return $check['system_health'] == 'true'; } From a1fef77bdcbb01d6f93a00f2e49997133378bd96 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 10 Jul 2024 11:09:42 +0300 Subject: [PATCH 2/2] Improve selfhost app load time --- app/Utils/SystemHealth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index aed67aaae11a..7c01643fe3be 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -43,7 +43,7 @@ class SystemHealth * @param bool $check_database * @return array Result set of checks */ - public static function check($check_database = true, $check_filesystem = true): array + public static function check($check_database = true, $check_file_system = true): array { $system_health = true; @@ -82,7 +82,7 @@ class SystemHealth 'pdf_engine' => (string) self::getPdfEngine(), 'queue' => (string) config('queue.default'), 'trailing_slash' => (bool) self::checkUrlState(), - 'file_permissions' => (string) ($check_filesystem ? self::checkFileSystem() : ''), + 'file_permissions' => (string) ($check_file_system ? self::checkFileSystem() : ''), 'exchange_rate_api_not_configured' => (bool)self::checkCurrencySanity(), 'api_version' => (string) config('ninja.app_version'), 'is_docker' => (bool) config('ninja.is_docker'),