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

github.com/nextcloud/survey_client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-08-19 11:05:33 +0300
committerMorris Jobke <hey@morrisjobke.de>2016-08-19 11:05:33 +0300
commitada2bbb598b3a3dacdb4bf6190b8d69aef8cd3d8 (patch)
treeec6ca69dd836048721f4c9d94de215f3e779c59e /lib
parentc4a9643ad92efbd5b058eb2ec8b90904ace71ce3 (diff)
Fix size calculation for MariaDB
Diffstat (limited to 'lib')
-rw-r--r--lib/Categories/Database.php25
1 files changed, 7 insertions, 18 deletions
diff --git a/lib/Categories/Database.php b/lib/Categories/Database.php
index 89be595..017f7e8 100644
--- a/lib/Categories/Database.php
+++ b/lib/Categories/Database.php
@@ -121,27 +121,16 @@ class Database implements ICategory {
// 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':