aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-06-11 18:13:52 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-06-11 18:13:52 +0000
commit01b41453812dc7b990f03b81f85dcfb9a18076fd (patch)
treed12e93524fa7625d1220088d34a5a957cd618624 /phpBB/includes/functions_admin.php
parentce3b07eee7dbefc68dcd8eab3ab667e6532c8561 (diff)
downloadforums-01b41453812dc7b990f03b81f85dcfb9a18076fd.tar
forums-01b41453812dc7b990f03b81f85dcfb9a18076fd.tar.gz
forums-01b41453812dc7b990f03b81f85dcfb9a18076fd.tar.bz2
forums-01b41453812dc7b990f03b81f85dcfb9a18076fd.tar.xz
forums-01b41453812dc7b990f03b81f85dcfb9a18076fd.zip
- fixed a few bugs
- added user_add() function - check posted images ([img]) for same domain/scipt and php files - auth_api.html updated to the coding guidelines look&feel - introduced ability to force non page-updates (cron is using it) - correctly resend coppa email git-svn-id: file:///svn/phpbb/trunk@6048 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php45
1 files changed, 17 insertions, 28 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 1b7e6f5647..748295e632 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2264,7 +2264,9 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limi
function get_database_size()
{
global $db, $user, $table_prefix;
-
+
+ $database_size = false;
+
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
switch (SQL_LAYER)
{
@@ -2289,7 +2291,7 @@ function get_database_size()
FROM ' . $db_name;
$result = $db->sql_query($sql);
- $dbsize = 0;
+ $database_size = 0;
while ($row = $db->sql_fetchrow($result))
{
if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB')))
@@ -2298,27 +2300,19 @@ function get_database_size()
{
if (strstr($row['Name'], $table_prefix))
{
- $dbsize += $row['Data_length'] + $row['Index_length'];
+ $database_size += $row['Data_length'] + $row['Index_length'];
}
}
else
{
- $dbsize += $row['Data_length'] + $row['Index_length'];
+ $database_size += $row['Data_length'] + $row['Index_length'];
}
}
}
$db->sql_freeresult($result);
}
- else
- {
- $dbsize = $user->lang['NOT_AVAILABLE'];
- }
}
- else
- {
- $dbsize = $user->lang['NOT_AVAILABLE'];
- }
-
+
break;
case 'mssql':
@@ -2327,9 +2321,9 @@ function get_database_size()
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
FROM sysfiles';
$result = $db->sql_query($sql);
- $dbsize = ($row = $db->sql_fetchrow($result)) ? intval($row['dbsize']) : $user->lang['NOT_AVAILABLE'];
+ $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false;
$db->sql_freeresult($result);
-
+
break;
case 'postgres':
@@ -2343,7 +2337,6 @@ function get_database_size()
if ($row['proname'] == 'pg_database_size')
{
-
$sql = "SELECT oid
FROM pg_database
WHERE datname = '" . $db->dbname . "'";
@@ -2358,26 +2351,22 @@ function get_database_size()
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $dbsize = $row['size'];
- }
- else
- {
- $dbsize = $user->lang['NOT_AVAILABLE'];
+ $database_size = $row['size'];
}
break;
-
- default:
-
- $dbsize = $user->lang['NOT_AVAILABLE'];
}
- if (is_int($dbsize))
+ if ($database_size !== false)
+ {
+ $database_size = ($database_size >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($database_size / 1048576)) : (($database_size >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($database_size / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $database_size));
+ }
+ else
{
- $dbsize = ($dbsize >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($dbsize / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $dbsize));
+ $database_size = $user->lang['NOT_AVAILABLE'];
}
- return $dbsize;
+ return $database_size;
}
/**