mirror of https://github.com/itflow-org/itflow
Get a more accurate count of Tables rows in Debug using count instead of relying on show table status as this is not accurate all the time.
This commit is contained in:
parent
61de8bc792
commit
f69de29353
|
|
@ -296,7 +296,13 @@ if ($tablesResult) {
|
||||||
|
|
||||||
while ($table = $tablesResult->fetch_assoc()) {
|
while ($table = $tablesResult->fetch_assoc()) {
|
||||||
$tableName = $table['Name'];
|
$tableName = $table['Name'];
|
||||||
$tableRows = $table['Rows'];
|
|
||||||
|
// Accurate row count
|
||||||
|
$countResult = $mysqli->query("SELECT COUNT(*) AS cnt FROM `$tableName`");
|
||||||
|
$countRow = $countResult->fetch_assoc();
|
||||||
|
$tableRows = $countRow['cnt'];
|
||||||
|
$countResult->free();
|
||||||
|
|
||||||
$dataLength = $table['Data_length'];
|
$dataLength = $table['Data_length'];
|
||||||
$indexLength = $table['Index_length'];
|
$indexLength = $table['Index_length'];
|
||||||
$tableSize = ($dataLength + $indexLength) / (1024 * 1024); // Size in MB
|
$tableSize = ($dataLength + $indexLength) / (1024 * 1024); // Size in MB
|
||||||
|
|
@ -336,11 +342,6 @@ if ($tablesResult) {
|
||||||
'name' => 'Total database size (MB)',
|
'name' => 'Total database size (MB)',
|
||||||
'value' => round($totalSize, 2) . ' MB',
|
'value' => round($totalSize, 2) . ' MB',
|
||||||
];
|
];
|
||||||
} else {
|
|
||||||
$databaseStats[] = [
|
|
||||||
'name' => 'Database connection error',
|
|
||||||
'value' => $mysqli->error,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Section: Database Structure Comparison
|
// Section: Database Structure Comparison
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue