1
0

Improved bundle updating

This commit is contained in:
Richard Dern 2024-05-05 17:31:32 +02:00
parent 4f1d24d22b
commit a0574f4c3d
4 changed files with 32 additions and 9 deletions

View File

@ -175,7 +175,7 @@ public function load(): void
/** /**
* Store all files of the bundle * Store all files of the bundle
*/ */
public function save(): void public function save(): bool
{ {
$attachmentsSaved = $this->saveAttachments(); $attachmentsSaved = $this->saveAttachments();
$metadataSaved = $this->saveMetadata(); $metadataSaved = $this->saveMetadata();
@ -187,19 +187,24 @@ public function save(): void
|| $markdownSaved || $markdownSaved
) { ) {
$this->touch(); $this->touch();
return true;
} }
return false;
} }
/** /**
* Repair bundle * Repair bundle
*/ */
public function repair(): void public function repair(): bool
{ {
$this->load(); $this->load();
$this->repairCover(); $this->repairCover();
$this->lintMarkdown(); $this->lintMarkdown();
$this->repairAttachments(); $this->repairAttachments();
$this->save();
return $this->save();
} }
public function touch() public function touch()

View File

@ -60,9 +60,13 @@ public function handle()
continue; continue;
} }
$updater->update(); $result = $updater->update();
if ($result) {
$this->info('OK'); $this->info('OK');
} else {
$this->comment('Update not needed');
}
} }
} }
} }

View File

@ -88,8 +88,15 @@ public function update()
'wikidata/links', 'wikidata/links',
]); ]);
$this->bundle->save(); $saved = $this->bundle->save();
if ($saved) {
$this->bundle->repair(); $this->bundle->repair();
} else {
$saved = $this->bundle->repair();
}
return $saved;
} }
/** /**

View File

@ -92,8 +92,15 @@ public function update()
} }
} }
$this->bundle->save(); $saved = $this->bundle->save();
if ($saved) {
$this->bundle->repair(); $this->bundle->repair();
} else {
$saved = $this->bundle->repair();
}
return $saved;
} }
/** /**