Added MSSQL DB size as provided by Josh ... feedback/updates welcome :)

git-svn-id: file:///svn/phpbb/trunk@2099 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-02-12 03:06:17 +00:00
parent e81ed1cc0a
commit 1ce5626c67

View file

@ -49,7 +49,7 @@ function inarray($needle, $haystack)
// //
// Generate relevant output // Generate relevant output
// //
if( $HTTP_GET_VARS['pane'] == 'left' ) if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' )
{ {
$dir = @opendir("."); $dir = @opendir(".");
@ -116,7 +116,7 @@ if( $HTTP_GET_VARS['pane'] == 'left' )
include('page_footer_admin.'.$phpEx); 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); 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 we couldn't get the table status.
} }
else else
@ -282,11 +269,43 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' )
$dbsize = $lang['Not_available']; $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 else
{ {
$dbsize = $lang['Not_available']; $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( $template->assign_vars(array(
"NUMBER_OF_POSTS" => $total_posts, "NUMBER_OF_POSTS" => $total_posts,
"NUMBER_OF_TOPICS" => $total_topics, "NUMBER_OF_TOPICS" => $total_topics,