aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorPatrick Webster <noxwizard@phpbb.com>2014-03-01 22:14:18 -0600
committerPatrick Webster <noxwizard@phpbb.com>2014-03-28 17:04:29 -0500
commit80a844d38ce17378bb12b2e84cc7db99932913f5 (patch)
treedef21db25fed57b09b68d84854d9c22ddd84d1b8 /phpBB/includes
parentb993fa54a5d8902590d0d6a83bbe1c581d043f46 (diff)
downloadforums-80a844d38ce17378bb12b2e84cc7db99932913f5.tar
forums-80a844d38ce17378bb12b2e84cc7db99932913f5.tar.gz
forums-80a844d38ce17378bb12b2e84cc7db99932913f5.tar.bz2
forums-80a844d38ce17378bb12b2e84cc7db99932913f5.tar.xz
forums-80a844d38ce17378bb12b2e84cc7db99932913f5.zip
[ticket/9725] Fetch Azure db stats from proper table
PHPBB3-9725
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_admin.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 2f73858ea2..3e69a997a2 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -3057,8 +3057,24 @@ function get_database_size()
case 'mssql':
case 'mssql_odbc':
case 'mssqlnative':
+ $sql = 'SELECT @@VERSION AS mssql_version';
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles';
+
+ if ($row)
+ {
+ // Azure stats are stored elsewhere
+ if (strpos($row['mssql_version'], 'SQL Azure') !== false)
+ {
+ $sql = 'SELECT ((SUM(reserved_page_count) * 8.0) * 1024.0) as dbsize
+ FROM sys.dm_db_partition_stats';
+ }
+ }
+
$result = $db->sql_query($sql, 7200);
$database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false;
$db->sql_freeresult($result);