1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 22:40:39 +02:00

Merge branch 'develop-olympus' into develop-ascraeus

* develop-olympus:
  [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

Conflicts:
	phpBB/install/schemas/mssql_schema.sql
This commit is contained in:
Joas Schilling
2014-03-29 10:50:18 +01:00
4 changed files with 468 additions and 347 deletions

View File

@@ -2920,8 +2920,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);