From a829db9890cda57c0647d5121efe68eeaf0a7cdb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 2 Nov 2020 09:51:56 +1100 Subject: [PATCH 1/2] Fixes for setup --- app/Http/Controllers/SetupController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 66f3d58d60..fde1074452 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -20,6 +20,7 @@ use App\Jobs\Util\VersionCheck; use App\Models\Account; use App\Utils\CurlUtils; use App\Utils\SystemHealth; +use App\Utils\Traits\AppSetup; use DB; use Exception; use Illuminate\Contracts\Foundation\Application; @@ -37,6 +38,8 @@ use Spatie\Browsershot\Browsershot; */ class SetupController extends Controller { + use AppSetup; + public function index() { $check = SystemHealth::check(false); @@ -127,6 +130,8 @@ class SetupController extends Controller } VersionCheck::dispatchNow(); + + $this->buildCache(); return redirect('/'); } catch (Exception $e) { From 9bbffea2600ca89a4e160f94625d71b404c51cbb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 2 Nov 2020 11:23:02 +1100 Subject: [PATCH 2/2] Fixes for setup --- app/Http/Controllers/SetupController.php | 2 +- app/Models/Gateway.php | 16 ---------------- app/Utils/Traits/AppSetup.php | 4 ++-- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index fde1074452..94af83064f 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -131,7 +131,7 @@ class SetupController extends Controller VersionCheck::dispatchNow(); - $this->buildCache(); + $this->buildCache(true); return redirect('/'); } catch (Exception $e) { diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 1b9c6edb6b..5a2ef08f1a 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -36,22 +36,6 @@ class Gateway extends StaticModel protected $dateFormat = 'Y-m-d H:i:s.u'; - // /** - // * @return mixed - // * @deprecated 5.0.17 No longer needs as we are removing omnipay dependence - // */ - // public function getFields() - // { - // if ($this->isCustom()) { - // return [ - // 'name' => '', - // 'text' => '', - // ]; - // } else { - // return Omnipay::create($this->provider)->getDefaultParameters(); - // } - // } - public function getOptionsAttribute() { return $this->getMethods(); diff --git a/app/Utils/Traits/AppSetup.php b/app/Utils/Traits/AppSetup.php index c28e8ea66f..cd8560b550 100644 --- a/app/Utils/Traits/AppSetup.php +++ b/app/Utils/Traits/AppSetup.php @@ -30,12 +30,12 @@ trait AppSetup return $check['system_health'] == 'true'; } - public function buildCache() + public function buildCache($force = false) { $cached_tables = config('ninja.cached_tables'); foreach ($cached_tables as $name => $class) { - if (request()->has('clear_cache') || ! Cache::has($name)) { + if (request()->has('clear_cache') || ! Cache::has($name) || $force) { // check that the table exists in case the migration is pending if (! Schema::hasTable((new $class())->getTable())) {