-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enh: Add details to CodeIntegrity setup check #43575
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,20 +53,51 @@ public function run(): SetupResult { | |
} elseif ($this->checker->hasPassedCheck()) { | ||
return SetupResult::success($this->l10n->t('No altered files')); | ||
} else { | ||
$completeResults = $this->checker->getResults(); | ||
$formattedTextResponse = ''; | ||
if (!empty($completeResults)) { | ||
$formattedTextResponse = '#### ' . $this->l10n->t('Technical information'); | ||
$formattedTextResponse .= "\n" . $this->l10n->t('The following list covers which files have failed the integrity check.'); | ||
$formattedTextResponse .= "\n"; | ||
foreach ($completeResults as $context => $contextResult) { | ||
$formattedTextResponse .= "- $context\n"; | ||
|
||
foreach ($contextResult as $category => $result) { | ||
$categoryName = match($category) { | ||
'EXCEPTION' => $this->l10n->t('Exception'), | ||
'EXTRA_FILE' => $this->l10n->t('Unexpected file'), | ||
'FILE_MISSING' => $this->l10n->t('Missing file'), | ||
'INVALID_HASH' => $this->l10n->t('Invalid file (hash mismatch)'), | ||
default => $category, | ||
}; | ||
$formattedTextResponse .= "\t- $categoryName\n"; | ||
if ($category !== 'EXCEPTION') { | ||
foreach ($result as $key => $results) { | ||
$formattedTextResponse .= "\t\t- $key\n"; | ||
} | ||
} else { | ||
foreach ($result as $key => $results) { | ||
$formattedTextResponse .= "\t\t- $results\n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should Also, these complete results will show in |
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return SetupResult::error( | ||
$this->l10n->t('Some files have not passed the integrity check. {link1} {link2}'), | ||
$this->l10n->t('Some files have not passed the integrity check. {rawOutput} {rescan}') . "\n\n" . $formattedTextResponse, | ||
$this->urlGenerator->linkToDocs('admin-code-integrity'), | ||
[ | ||
'link1' => [ | ||
'rawOutput' => [ | ||
'type' => 'highlight', | ||
'id' => 'getFailedIntegrityCheckFiles', | ||
'name' => 'List of invalid files…', | ||
'name' => $this->l10n->t('Raw output…'), | ||
'link' => $this->urlGenerator->linkToRoute('settings.CheckSetup.getFailedIntegrityCheckFiles'), | ||
], | ||
'link2' => [ | ||
'rescan' => [ | ||
'type' => 'highlight', | ||
'id' => 'rescanFailedIntegrityCheck', | ||
'name' => 'Rescan…', | ||
'name' => $this->l10n->t('Rescan…'), | ||
'link' => $this->urlGenerator->linkToRoute('settings.CheckSetup.rescanFailedIntegrityCheck'), | ||
], | ||
], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@come-nc this one is for the admin settings page to show the output correctly.