From f32f36fc74d23c6908ae17d334114cd4fc8d1ec2 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Mon, 26 Sep 2022 11:51:38 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B05551=20-=20System=20information=20databa?= =?UTF-8?q?se=20size=20is=20way=20off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Service/DBToolsUtils.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php b/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php index 5932c1a00..d91002eb8 100644 --- a/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php +++ b/datamodels/2.x/combodo-db-tools/src/Service/DBToolsUtils.php @@ -14,6 +14,22 @@ use DBObjectSet; class DBToolsUtils { + private static bool $bAnalyzed = false; + + private final static function AnalyzeTables() + { + if (self::$bAnalyzed) { + return; + } + + $oResult = CMDBSource::Query('SHOW TABLES;'); + while ($aRow = $oResult->fetch_array()) { + $sTable = $aRow['0']; + CMDBSource::Query("ANALYZE TABLE `$sTable`; "); + } + self::$bAnalyzed = true; + } + /** * @return int * @throws \CoreException @@ -22,6 +38,7 @@ class DBToolsUtils */ public final static function GetDatabaseSize() { + self::AnalyzeTables(); $sSchema = CMDBSource::DBName(); $sReq = <<