mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°5551 - System information database size is way off
This commit is contained in:
@@ -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 = <<<EOF
|
||||
@@ -48,6 +65,7 @@ EOF;
|
||||
*/
|
||||
public final static function GetDBDataSize()
|
||||
{
|
||||
self::AnalyzeTables();
|
||||
$sSchema = CMDBSource::DBName();
|
||||
|
||||
$sReq = <<<EOF
|
||||
@@ -74,6 +92,7 @@ EOF;
|
||||
*/
|
||||
public final static function GetDBIndexSize()
|
||||
{
|
||||
self::AnalyzeTables();
|
||||
$sSchema = CMDBSource::DBName();
|
||||
|
||||
$sReq = <<<EOF
|
||||
@@ -127,6 +146,7 @@ EOF;
|
||||
|
||||
public static function GetDBTablesInfo()
|
||||
{
|
||||
self::AnalyzeTables();
|
||||
$sSchema = CMDBSource::DBName();
|
||||
|
||||
$sReq = <<<EOF
|
||||
|
||||
Reference in New Issue
Block a user