From 1c9d1c17330ec094f88957443c901348f366188c Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 21 Oct 2020 14:12:38 -0400 Subject: [PATCH] Extra logs/skip module seed pending --- app/Services/Installer/InstallerService.php | 6 ++++- app/Services/Installer/SeederService.php | 28 --------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/app/Services/Installer/InstallerService.php b/app/Services/Installer/InstallerService.php index fe1d8c35..a99673fb 100644 --- a/app/Services/Installer/InstallerService.php +++ b/app/Services/Installer/InstallerService.php @@ -4,6 +4,7 @@ namespace App\Services\Installer; use App\Contracts\Service; use Illuminate\Support\Facades\Artisan; +use Illuminate\Support\Facades\Log; class InstallerService extends Service { @@ -27,11 +28,14 @@ class InstallerService extends Service */ public function isUpgradePending(): bool { - if (count($this->migrationSvc->migrationsAvailable()) > 0) { + $pendingMigrations = count($this->migrationSvc->migrationsAvailable()); + if ($pendingMigrations > 0) { + Log::info('Found '.$pendingMigrations.' pending migrations, update available'); return true; } if ($this->seederSvc->seedsPending()) { + Log::info('Found seeds pending, update available'); return true; } diff --git a/app/Services/Installer/SeederService.php b/app/Services/Installer/SeederService.php index ff12b07d..fec1b2b3 100644 --- a/app/Services/Installer/SeederService.php +++ b/app/Services/Installer/SeederService.php @@ -43,10 +43,6 @@ class SeederService extends Service return true; } - if ($this->moduleSeedsPending()) { - return true; - } - return false; } @@ -310,28 +306,4 @@ class SeederService extends Service return false; } - - private function moduleSeedsPending(): bool - { - $all_modules = DB::table('modules')->get(); - - $data = file_get_contents(database_path('/seeds/modules.yml')); - $yml = Yaml::parse($data); - - foreach ($yml as $perm) { - $row = $all_modules->firstWhere('name', $perm['name']); - if (!$row) { - return true; - } - - // See if any of these column values have changed - foreach (['name', 'enabled'] as $column) { - if ($row->{$column} !== $perm[$column]) { - return true; - } - } - } - - return false; - } }