diff options
author | Patrick Webster <noxwizard@phpbb.com> | 2014-03-01 22:14:18 -0600 |
---|---|---|
committer | Patrick Webster <noxwizard@phpbb.com> | 2014-03-28 17:04:29 -0500 |
commit | 80a844d38ce17378bb12b2e84cc7db99932913f5 (patch) | |
tree | def21db25fed57b09b68d84854d9c22ddd84d1b8 /phpBB/includes | |
parent | b993fa54a5d8902590d0d6a83bbe1c581d043f46 (diff) | |
download | forums-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.php | 16 |
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); |