Extra logs/skip module seed pending

This commit is contained in:
Nabeel Shahzad 2020-10-21 14:12:38 -04:00
parent cd18442207
commit 1c9d1c1733
2 changed files with 5 additions and 29 deletions

View File

@ -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;
}

View File

@ -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;
}
}