Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/serverinfo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2016-09-08 12:56:24 +0300
committerGitHub <noreply@github.com>2016-09-08 12:56:24 +0300
commit51b1a911ad7ac5a19092ea7a6e8800fc5b9143e7 (patch)
tree6979568c5980c370b82adeff26e96f491c8322dd
parent0a11424d1a7b351e7a53c2521b04293984ee271c (diff)
parent22d8450e2deafb0a5473515f4ef01e8b3143514f (diff)
Merge pull request #35 from nextcloud/stable10-backport-34v10.0.1RC1v10.0.1
[stable10] Fix size calculation for MariaDB
-rw-r--r--lib/DatabaseStatistics.php24
1 files changed, 7 insertions, 17 deletions
diff --git a/lib/DatabaseStatistics.php b/lib/DatabaseStatistics.php
index 88c9557..b1a663c 100644
--- a/lib/DatabaseStatistics.php
+++ b/lib/DatabaseStatistics.php
@@ -92,26 +92,16 @@ class DatabaseStatistics {
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
switch ($this->config->getSystemValue('dbtype')) {
case 'mysql':
- $sql = 'SELECT VERSION() AS mysql_version';
+ $db_name = $this->config->getSystemValue('dbname');
+ $sql = 'SHOW TABLE STATUS FROM ' . $db_name;
$result = $this->connection->executeQuery($sql);
- $row = $result->fetch();
- $result->closeCursor();
- if ($row) {
- $version = $row['mysql_version'];
- if (preg_match('#(3\.23|[45]\.)#', $version)) {
- $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$this->config->getSystemValue('dbname')}`" : $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'))) {
- $database_size += $row['Data_length'] + $row['Index_length'];
- }
- }
- $result->closeCursor();
+ $database_size = 0;
+ while ($row = $result->fetch()) {
+ if ((isset($row['Type']) && $row['Type'] !== 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB'))) {
+ $database_size += $row['Data_length'] + $row['Index_length'];
}
}
+ $result->closeCursor();
break;
case 'sqlite':
case 'sqlite3':