Changeset 14420
- Timestamp:
- 05/03/2010 10:40:02 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ms.php
r14404 r14420 400 400 return true; 401 401 402 $space_allowed = get_space_allowed(); 402 if ( !( $space_allowed = get_upload_space_available() ) ) 403 return false; 404 405 return true; 406 } 407 408 function upload_size_limit_filter( $size ) { 409 return min( $size, get_upload_space_available() ); 410 } 411 /** 412 * Determines if there is any upload space left in the current blog's quota. 413 * 414 * @return int of upload space available in bytes 415 */ 416 function get_upload_space_available() { 417 $space_allowed = get_space_allowed() * 1024 * 1024; 418 if ( get_site_option( 'upload_space_check_disabled' ) ) 419 return $space_allowed; 403 420 404 421 $dir_name = trailingslashit( BLOGUPLOADDIR ); 405 422 if ( !( is_dir( $dir_name) && is_readable( $dir_name ) ) ) 406 return true;423 return $space_allowed; 407 424 408 425 $dir = dir( $dir_name ); … … 419 436 } 420 437 $dir->close(); 421 $size = $size / 1024 / 1024;422 438 423 439 if ( ( $space_allowed - $size ) <= 0 ) 424 return false;425 426 return true;440 return 0; 441 442 return $space_allowed - $size; 427 443 } 428 444 -
trunk/wp-includes/ms-default-filters.php
r13998 r14420 46 46 add_filter( 'upload_mimes', 'check_upload_mimes' ); 47 47 add_action( 'admin_notices', 'ms_deprecated_blogs_file' ); 48 add_action( 'upload_size_limit', 'upload_size_limit_filter' ); 48 49 49 50 // Mail
Note: See TracChangeset
for help on using the changeset viewer.