|
From: Paul S. O. <ps...@us...> - 2002-02-12 03:06:20
|
Update of /cvsroot/phpbb/phpBB2/admin
In directory usw-pr-cvs1:/tmp/cvs-serv8496/admin
Modified Files:
index.php
Log Message:
Added MSSQL DB size as provided by Josh ... feedback/updates welcome :)
Index: index.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/admin/index.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** index.php 27 Jan 2002 02:19:45 -0000 1.34
--- index.php 12 Feb 2002 03:06:17 -0000 1.35
***************
*** 50,54 ****
// Generate relevant output
//
! if( $HTTP_GET_VARS['pane'] == 'left' )
{
$dir = @opendir(".");
--- 50,54 ----
// Generate relevant output
//
! if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
{
$dir = @opendir(".");
***************
*** 117,121 ****
include('page_footer_admin.'.$phpEx);
}
! elseif( $HTTP_GET_VARS['pane'] == 'right' )
{
--- 117,121 ----
include('page_footer_admin.'.$phpEx);
}
! elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
{
***************
*** 258,274 ****
}
}
-
- 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.
}
--- 258,261 ----
***************
*** 283,289 ****
--- 270,308 ----
}
}
+ 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);
+ }
}
|