Changeset 12824
- Timestamp:
- 01/25/2010 07:46:24 PM (15 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/admin.php
r12823 r12824 56 56 57 57 /** WordPress Multi-Site support API */ 58 if ( is_multisite() ) 58 if ( is_multisite() ) { 59 59 require_once(ABSPATH . 'wp-admin/includes/ms.php'); 60 require_once(ABSPATH . 'wp-admin/includes/ms-deprecated.php'); 61 } 60 62 61 63 ?> -
trunk/wp-admin/includes/deprecated.php
r12823 r12824 1 1 <?php 2 /** 3 * Deprecated admin functions from past WordPress versions. You shouldn't use these 4 * globals and functions and look for the alternatives instead. The functions 5 * and globals will be removed in a later version. 6 * 7 * @package WordPress 8 * @subpackage Deprecated 9 */ 2 10 3 11 /** -
trunk/wp-admin/includes/media.php
r12789 r12824 1398 1398 </div> 1399 1399 1400 <?php do_action('pre-upload-ui'); ?> 1401 1402 <?php if ( $flash ) : ?> 1400 <?php 1401 // Check quota for this blog if multisite 1402 if ( is_multisite() && !is_upload_space_available() ) 1403 wp_die( __('Sorry, you must delete files before you can upload any more.') ); 1404 1405 do_action('pre-upload-ui'); 1406 1407 if ( $flash ) : ?> 1403 1408 <script type="text/javascript"> 1404 1409 //<![CDATA[ … … 2230 2235 2231 2236 add_filter('media_upload_library', 'media_upload_library'); 2232 -
trunk/wp-admin/includes/ms.php
r12804 r12824 356 356 } 357 357 358 /** 359 * Determines if there is any upload space left in the current blog's quota. 360 * 361 * @return bool True if space is available, false otherwise. 362 */ 363 function is_upload_space_available() { 364 if ( get_site_option( 'upload_space_check_disabled' ) ) 365 return true; 366 367 $space_allowed = get_space_allowed(); 368 369 $dir_name = trailingslashit( BLOGUPLOADDIR ); 370 if ( !(is_dir($dir_name) && is_readable($dir_name)) ) 371 return true; 372 373 $dir = dir($dir_name); 374 $size = 0; 375 376 while ( $file = $dir->read() ) { 377 if ( $file != '.' && $file != '..' ) { 378 if ( is_dir( $dir_name . $file) ) { 379 $size += get_dirsize($dir_name . $file); 380 } else { 381 $size += filesize($dir_name . $file); 382 } 383 } 384 } 385 $dir->close(); 386 $size = $size / 1024 / 1024; 387 388 if ( ($space_allowed - $size) <= 0 ) 389 return false; 390 391 return true; 392 } 393 394 /** 395 * Returns the upload quota for the current blog. 396 * 397 * @return int Quota 398 */ 358 399 function get_space_allowed() { 359 $space Allowed = get_option("blog_upload_space");360 if ( $space Allowed == false )361 $space Allowed = get_site_option("blog_upload_space");362 if ( empty($space Allowed) || !is_numeric($spaceAllowed) )363 $space Allowed = 50;364 365 return $space Allowed;400 $space_allowed = get_option('blog_upload_space'); 401 if ( $space_allowed == false ) 402 $space_allowed = get_site_option('blog_upload_space'); 403 if ( empty($space_allowed) || !is_numeric($space_allowed) ) 404 $space_allowed = 50; 405 406 return $space_allowed; 366 407 } 367 408 … … 370 411 $used = get_dirsize( BLOGUPLOADDIR )/1024/1024; 371 412 372 if ($used > $space) $percentused = '100'; 373 else $percentused = ( $used / $space ) * 100; 413 if ( $used > $space ) 414 $percentused = '100'; 415 else 416 $percentused = ( $used / $space ) * 100; 374 417 375 418 if ( $space > 1000 ) { … … 460 503 } 461 504 462 /*463 Determines if the available space defined by the admin has been exceeded by the user464 */465 function wpmu_checkAvailableSpace() {466 if ( get_site_option( 'upload_space_check_disabled' ) ) {467 return true;468 }469 $spaceAllowed = get_space_allowed();470 471 $dirName = trailingslashit( BLOGUPLOADDIR );472 if (!(is_dir($dirName) && is_readable($dirName)))473 return;474 475 $dir = dir($dirName);476 $size = 0;477 478 while($file = $dir->read()) {479 if ($file != '.' && $file != '..') {480 if (is_dir( $dirName . $file)) {481 $size += get_dirsize($dirName . $file);482 } else {483 $size += filesize($dirName . $file);484 }485 }486 }487 $dir->close();488 $size = $size / 1024 / 1024;489 490 if ( ($spaceAllowed - $size) <= 0 ) {491 wp_die( __('Sorry, you must delete files before you can upload any more.') );492 }493 }494 add_action('pre-upload-ui','wpmu_checkAvailableSpace');495 496 505 function format_code_lang( $code = '' ) { 497 506 $code = strtolower(substr($code, 0, 2)); … … 553 562 } 554 563 add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 ); 555 556 function wpmu_menu() {557 // deprecated. See #11763558 }559 564 560 565 function mu_options( $options ) {
Note: See TracChangeset
for help on using the changeset viewer.