aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-29 10:43:09 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-29 10:43:09 +0100
commit4e8aef7cd6036b893ee74928b047aaad4a8a84ad (patch)
tree9c1d50d95fb53040db9b78f5e04749ee4b3dbb2f /phpBB/includes/functions_admin.php
parent40ed3f677699f2d9801bb75168e84766c35722f4 (diff)
parent79492d41109eba2932c020bb5c9a90f19aac2321 (diff)
downloadforums-4e8aef7cd6036b893ee74928b047aaad4a8a84ad.tar
forums-4e8aef7cd6036b893ee74928b047aaad4a8a84ad.tar.gz
forums-4e8aef7cd6036b893ee74928b047aaad4a8a84ad.tar.bz2
forums-4e8aef7cd6036b893ee74928b047aaad4a8a84ad.tar.xz
forums-4e8aef7cd6036b893ee74928b047aaad4a8a84ad.zip
Merge remote-tracking branch 'noxwizard/ticket/naderman/9725' into develop-olympus
* noxwizard/ticket/naderman/9725: [ticket/9725] Code sniffer fixes [ticket/9725] Do not use deprecated views to remove default constraints [ticket/9725] Move primary key creation to the correct location [ticket/9725] Remove trailing spaces from MSSQL schema [ticket/9725] Create MSSQL primary keys if none exist [ticket/9725] Remove explicit filegroup designations [ticket/9725] Fetch Azure db stats from proper table [ticket/9725] Add dummy indexes for Azure [ticket/9725] Create an Azure SQL compatible Schema
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-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);