Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix MySQL database size calculation
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Dec 14, 2020
commit 6814c0f7f37e5374d9e279827b5a77a36dfde269
3 changes: 2 additions & 1 deletion lib/DatabaseStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ protected function databaseSize() {
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
switch ($this->config->getSystemValue('dbtype')) {
case 'mysql':
$mysqlEngine = ['MyISAM', 'InnoDB', 'Aria'];
$db_name = $this->config->getSystemValue('dbname');
$sql = 'SHOW TABLE STATUS FROM `' . $db_name . '`';
$result = $this->connection->executeQuery($sql);
$database_size = 0;
while ($row = $result->fetch()) {
if ((isset($row['Type']) && $row['Type'] !== 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] === 'MyISAM' || $row['Engine'] === 'InnoDB'))) {
if (isset($row['Engine']) && in_array($row['Engine'], $mysqlEngine)) {
$database_size += $row['Data_length'] + $row['Index_length'];
}
}
Expand Down