diff --git a/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php b/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php index f8b2756de..8b7a90ce3 100644 --- a/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php +++ b/datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php @@ -21,6 +21,8 @@ use Combodo\iTop\Core\MetaModel\HierarchicalKey; class DatabaseAnalyzer { + const LIMIT = 100; + var $iTimeLimitPerOperation; public function __construct($iTimeLimitPerOperation = null) @@ -45,7 +47,7 @@ class DatabaseAnalyzer set_time_limit(intval($this->iTimeLimitPerOperation)); } - $aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs); + $aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs.' limit '.self::LIMIT); if (count($aWrongRecords) > 0) { foreach($aWrongRecords as $aRes) diff --git a/datamodels/2.x/combodo-db-tools/dbtools.php b/datamodels/2.x/combodo-db-tools/dbtools.php index e48b9dbf0..65acd2c3b 100644 --- a/datamodels/2.x/combodo-db-tools/dbtools.php +++ b/datamodels/2.x/combodo-db-tools/dbtools.php @@ -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('
'.Dict::format('DBTools:DetailedErrorLimit', DatabaseAnalyzer::LIMIT).'
'); + $oCollapsible->AddSubBlock($oHTML); + } + $oFieldSet = FieldSetUIBlockFactory::MakeStandard(Dict::S('DBTools:SQLquery')); $oCollapsible->AddSubBlock($oFieldSet); diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php index d88ed63ea..f50c7ad1d 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/en.dict.combodo-db-tools.php @@ -49,6 +49,7 @@ Dict::Add('EN US', 'English', 'English', array( 'DBTools:Inconsistencies' => 'Database inconsistencies', 'DBTools:DetailedErrorTitle' => '%2$s error(s) in class %1$s: %3$s', + 'DBTools:DetailedErrorLimit' => 'List limited to %1$s errors', 'DBAnalyzer-Integrity-OrphanRecord' => 'Orphan record in `%1$s`, it should have its counterpart in table `%2$s`', 'DBAnalyzer-Integrity-InvalidExtKey' => 'Invalid external key %1$s (column: `%2$s.%3$s`)', diff --git a/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php index 62e6cac09..4d431ffb9 100644 --- a/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/dictionaries/fr.dict.combodo-db-tools.php @@ -44,6 +44,7 @@ Dict::Add('FR FR', 'French', 'Français', array( 'DBTools:Inconsistencies' => 'Incohérences de base de données', 'DBTools:DetailedErrorTitle' => '%2$s erreur(s) dans la classe %1$s : %3$s', + 'DBTools:DetailedErrorLimit' => 'Liste limitée à %1$s erreurs', 'DBAnalyzer-Integrity-OrphanRecord' => 'Enregistrement orphelin dans `%1$s`, il devrait avoir son équivalent dans la table `%2$s`', 'DBAnalyzer-Integrity-InvalidExtKey' => 'Clé externe invalide %1$s (colonne: `%2$s.%3$s`)', diff --git a/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php b/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php index cada8bdbc..73630427f 100644 --- a/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php +++ b/datamodels/2.x/combodo-db-tools/src/Service/DBAnalyzerUtils.php @@ -8,6 +8,7 @@ namespace Combodo\iTop\DBTools\Service; use CoreException; +use DatabaseAnalyzer; use Dict; use DictExceptionMissingString; use MetaModel; @@ -38,6 +39,9 @@ class DBAnalyzerUtils fwrite($fReport, "\r\n-- \r\n"); fwrite($fReport, '-- Class: '.MetaModel::GetName($sClass).' ('.$sClass.")\r\n"); $iCount = $aError['count']; + if ($iCount === DatabaseAnalyzer::LIMIT) { + $iCount = "$iCount(+)"; + } fwrite($fReport, '-- Count: '.$iCount."\r\n"); fwrite($fReport, '-- Error: '.$sErrorLabel."\r\n"); if (array_key_exists('query', $aError)) {