Changeset 22497 for trunk/wp-admin/includes/ms.php
- Timestamp:
- 11/09/2012 10:35:42 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/ms.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ms.php
r22378 r22497 291 291 292 292 /** 293 * @since 3.0.0294 *295 * @return int of upload size limit in bytes296 */297 function upload_size_limit_filter( $size ) {298 $fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 );299 if ( get_site_option( 'upload_space_check_disabled' ) )300 return min( $size, $fileupload_maxk );301 302 return min( $size, $fileupload_maxk, get_upload_space_available() );303 }304 /**305 * Determines if there is any upload space left in the current blog's quota.306 *307 * @since 3.0.0308 *309 * @return int of upload space available in bytes310 */311 function get_upload_space_available() {312 $space_allowed = get_space_allowed() * 1024 * 1024;313 if ( get_site_option( 'upload_space_check_disabled' ) )314 return $space_allowed;315 316 $space_used = get_space_used() * 1024 * 1024;317 318 if ( ( $space_allowed - $space_used ) <= 0 )319 return 0;320 321 return $space_allowed - $space_used;322 }323 324 /**325 293 * Check whether a blog has used its allotted upload space. 326 294 * … … 347 315 return false; 348 316 } 349 }350 351 /**352 * Returns the space used by the current blog.353 *354 * @since 3.5.0355 *356 * @return int Used space in megabytes357 */358 function get_space_used() {359 // Allow for an alternative way of tracking storage space used360 $space_used = apply_filters( 'pre_get_space_used', false );361 if ( false === $space_used ) {362 $upload_dir = wp_upload_dir();363 $space_used = get_dirsize( $upload_dir['basedir'] ) / 1024 / 1024;364 }365 366 return $space_used;367 }368 369 /**370 * Returns the upload quota for the current blog.371 *372 * @since MU373 *374 * @return int Quota in megabytes375 */376 function get_space_allowed() {377 $space_allowed = get_option( 'blog_upload_space' );378 379 if ( ! is_numeric( $space_allowed ) )380 $space_allowed = get_site_option( 'blog_upload_space' );381 382 if ( empty( $space_allowed ) || ! is_numeric( $space_allowed ) )383 $space_allowed = 50;384 385 return $space_allowed;386 317 } 387 318
Note: See TracChangeset
for help on using the changeset viewer.