Skip to content

Commit d306362

Browse files
authored
Merge pull request #61 from joomla-projects/feature/ignore-specific-postprocess-errors
Ignore specific finalizeition errors to reduce noise for logs and users
2 parents 2336977 + 87aa3d7 commit d306362

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

app/Jobs/UpdateSite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function handle(): void
142142
// Run the postupdate steps
143143
$postUpdateResult = $connection->finalizeUpdate(["fromVersion" => $healthResult->cms_version]);
144144

145-
if (!$postUpdateResult->success) {
145+
if (!$postUpdateResult->success && !$postUpdateResult->hasIgnorableError()) {
146146
throw new UpdateException(
147147
"finalize",
148148
"Update for site failed in postprocessing: " . $this->site->id . ", errors: " . json_encode($postUpdateResult->errors),

app/RemoteSite/Responses/FinalizeUpdate.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,23 @@ public function __construct(
1111
public ?array $errors = null,
1212
) {
1313
}
14+
15+
public function hasIgnorableError(): bool
16+
{
17+
if (is_null($this->errors)) {
18+
return false;
19+
}
20+
21+
$errorString = (string) json_encode($this->errors);
22+
23+
if (str_contains($errorString, 'Undefined constant') && str_contains($errorString, 'T4PATH_MEDIA')) {
24+
return true;
25+
}
26+
27+
if (str_contains($errorString, 'Error on updating manifest cache') && str_contains($errorString, 'T4PATH_MEDIA')) {
28+
return true;
29+
}
30+
31+
return false;
32+
}
1433
}

0 commit comments

Comments
 (0)