Ticket #21181: 21181.3.patch
File 21181.3.patch, 2.1 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/ms.php
302 302 /** 303 303 * Determines if there is any upload space left in the current blog's quota. 304 304 * 305 * @since 3.0.0 306 * 305 307 * @return int of upload space available in bytes 306 308 */ 307 309 function get_upload_space_available() { … … 331 333 332 334 $space_allowed = get_space_allowed(); 333 335 if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) ) 334 $space_allowed = 10; // Default space allowed is 10 MB336 $space_allowed = 10; // Default space allowed is 10 MB 335 337 336 338 $space_used = get_space_used(); 337 339 338 if ( ( $space_allowed - $space_used ) < 0 ) {340 if ( ( $space_allowed - $space_used ) < 0 ) { 339 341 if ( $echo ) 340 342 _e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' ); 341 343 return true; … … 344 346 } 345 347 } 346 348 349 /** 350 * Returns the space used by the current blog. 351 * 352 * @since 3.5.0 353 * 354 * @return int Used space in megabytes 355 */ 347 356 function get_space_used() { 348 357 // Allow for an alternative way of tracking storage space used 349 358 $space_used = apply_filters( 'pre_get_space_used', false ); 350 359 if ( false === $space_used ) 351 $space_used = get_dirsize( BLOGUPLOADDIR ) ;360 $space_used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024; 352 361 353 362 return $space_used; 354 363 } … … 356 365 /** 357 366 * Returns the upload quota for the current blog. 358 367 * 359 * @return int Quota 368 * @since MU 369 * 370 * @return int Quota in megabytes 360 371 */ 361 372 function get_space_allowed() { 362 373 $space_allowed = get_option( 'blog_upload_space' ); … … 370 381 return $space_allowed; 371 382 } 372 383 384 /** 385 * Displays the amount of disk space used by the current blog. Not used in core. 386 * 387 * @since MU 388 */ 373 389 function display_space_usage() { 374 390 $space_allowed = get_space_allowed(); 375 391 $space_used = get_space_used(); … … 406 422 return 0; 407 423 408 424 $available = get_upload_space_available(); 409 return min( $size, $available );425 return min( $size, $available ); 410 426 } 411 427 412 428 // Edit blog upload space setting on Edit Blog page