N°5900 - DB integrity analysis crashes when too many errors - limit the results to 100 to avoid memory errors

This commit is contained in:
Eric Espie
2023-01-19 08:51:02 +01:00
parent 9dc54d6e4c
commit f75a51d59e
6 changed files with 25 additions and 4 deletions

View File

@@ -207,9 +207,13 @@ function DisplayErrorList($aResults)
foreach ($aResults as $sClass => $aErrorList) {
foreach ($aErrorList as $sErrorLabel => $aError) {
$iCount = $aError['count'];
if ($iCount === DatabaseAnalyzer::LIMIT) {
$iCount = "$iCount(+)";
}
$aRows[] = [
'class' => MetaModel::GetName($sClass).' ('.$sClass.')',
'count' => $aError['count'],
'count' => $iCount,
'error' => $sErrorLabel,
];
}
@@ -227,10 +231,19 @@ function DisplayErrorDetails($aResults, $bVerbose)
foreach ($aResults as $sClass => $aErrorList) {
foreach ($aErrorList as $sErrorLabel => $aError) {
$sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $aError['count'], $sErrorLabel);
$iCount = $aError['count'];
if ($iCount === DatabaseAnalyzer::LIMIT) {
$iCount = "$iCount(+)";
}
$sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $iCount, $sErrorLabel);
$oCollapsible = CollapsibleSectionUIBlockFactory::MakeStandard($sErrorTitle);
$oBlock->AddSubBlock($oCollapsible);
if ($aError['count'] === DatabaseAnalyzer::LIMIT) {
$oHTML = new Combodo\iTop\Application\UI\Base\Component\Html\Html('<p>'.Dict::format('DBTools:DetailedErrorLimit', DatabaseAnalyzer::LIMIT).'</p>');
$oCollapsible->AddSubBlock($oHTML);
}
$oFieldSet = FieldSetUIBlockFactory::MakeStandard(Dict::S('DBTools:SQLquery'));
$oCollapsible->AddSubBlock($oFieldSet);