From 1ce5626c67f28523e1ed45939e33d79553160ad7 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 12 Feb 2002 03:06:17 +0000 Subject: [PATCH] Added MSSQL DB size as provided by Josh ... feedback/updates welcome :) git-svn-id: file:///svn/phpbb/trunk@2099 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/index.php | 49 ++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index e2538f2fc1..f02802db1e 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -49,7 +49,7 @@ function inarray($needle, $haystack) // // Generate relevant output // -if( $HTTP_GET_VARS['pane'] == 'left' ) +if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' ) { $dir = @opendir("."); @@ -116,7 +116,7 @@ if( $HTTP_GET_VARS['pane'] == 'left' ) include('page_footer_admin.'.$phpEx); } -elseif( $HTTP_GET_VARS['pane'] == 'right' ) +elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' ) { include('page_header_admin.'.$phpEx); @@ -257,19 +257,6 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) } } } - - if( $dbsize >= 1048576 ) - { - $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); - } - else if( $dbsize >= 1024 ) - { - $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); - } - else - { - $dbsize = sprintf("%.2f Bytes", $dbsize); - } } // Else we couldn't get the table status. } else @@ -282,11 +269,43 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) $dbsize = $lang['Not_available']; } } + else if( preg_match("/^mssql/", SQL_LAYER) ) + { + $sql = "SELECT ( SELECT SUM(reserved) + FROM sysindexes where indid in(0,1,255)) + * low AS dbsize + FROM master.dbo.spt_values + WHERE number = 1 AND type = 'E'"; + if( $result = $db->sql_query($sql) ) + { + $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available']; + } + else + { + $dbsize = $lang['Not_available']; + } + } else { $dbsize = $lang['Not_available']; } + if ( is_integer($dbsize) ) + { + if( $dbsize >= 1048576 ) + { + $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); + } + else if( $dbsize >= 1024 ) + { + $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); + } + else + { + $dbsize = sprintf("%.2f Bytes", $dbsize); + } + } + $template->assign_vars(array( "NUMBER_OF_POSTS" => $total_posts, "NUMBER_OF_TOPICS" => $total_topics,