summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-18 11:27:32 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-18 11:27:32 +0000
commit761327a211dd45fed1b0cb0fea433918fb728dc0 (patch)
tree2cf89f17a2ecbf8f91c32bf078e1a18527b7baf8 /wp-admin/includes
parentd67b8e8debe311de5cfdc393c36513b89bef9c40 (diff)
downloadwordpress-mu-761327a211dd45fed1b0cb0fea433918fb728dc0.tar.gz
wordpress-mu-761327a211dd45fed1b0cb0fea433918fb728dc0.tar.xz
wordpress-mu-761327a211dd45fed1b0cb0fea433918fb728dc0.zip
Cleanup mu.php by ktlee, fixes #453
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1099 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/includes')
-rw-r--r--wp-admin/includes/mu.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/wp-admin/includes/mu.php b/wp-admin/includes/mu.php
index 9dbcf05..2e623cc 100644
--- a/wp-admin/includes/mu.php
+++ b/wp-admin/includes/mu.php
@@ -207,7 +207,10 @@ function get_space_allowed() {
function display_space_usage() {
$space = get_space_allowed();
- $percentused = ( intval( get_dirsize( constant( "ABSPATH" ) . constant( "UPLOADS" ) )/1024/1024 ) / $space ) * 100;
+ $used = get_dirsize( constant( "ABSPATH" ) . constant( "UPLOADS" ) )/1024/1024;
+
+ if ($used > $space) $percentused = '100';
+ else $percentused = ( $used / $space ) * 100;
if( $space > 1000 ) {
$space = number_format( $space / 1024 );
@@ -222,23 +225,19 @@ function display_space_usage() {
// Display File upload quota on dashboard
function dashboard_quota() {
- $quota_mb = get_space_allowed();
- $quota = $quota_mb * 1024 * 1024;
- if( $quota == 0 ) $quota=10*1024*1024;
+ $quota = get_space_allowed();
+ $used = get_dirsize( constant( "ABSPATH" ) . constant( "UPLOADS" ) )/1024/1024;
+
+ if ($used > $quota) $percentused = '100';
+ else $percentused = ( $used / $quota ) * 100;
- $used = get_dirsize( constant( "ABSPATH" ) . constant( "UPLOADS" ) );
- $remaining = $quota - $used;
?>
<div id='spaceused'>
<h3><?php _e("Storage Space <a href='upload.php' title='Manage Uploads...'>&raquo;</a>"); ?></h3>
- <p><?php _e('Total Space Avaiable:'); ?> <strong><?php echo $quota_mb.__('MB'); ?></strong></p>
+ <p><?php _e('Total Space Avaiable:'); ?> <strong><?php echo $quota . __('MB'); ?></strong></p>
<p><?php _e('Upload Space Used:');
- $quota = $quota / 1024 / 1024;
- $size = round( ($used / 1024 / 1024) , 2);
- $pct = round(($size / $quota)*100);
- if ($size > $quota) $pct = '100';
?>
- <strong><?php printf(__('%1sMB (%2s%%)'), number_format($size), $pct ); ?></strong></p>
+ <strong><?php printf(__('%1sMB (%2s%%)'), round($used,2), number_format($percentused) ); ?></strong></p>
</div>
<?php
}