WordPress.org

WordPress MU

Changeset 2026


Ignore:
Timestamp:
12/11/09 17:40:44 (4 years ago)
Author:
donncha
Message:

Added "upload_space_check_disabled" site option to disable space check. Fixes #1175

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/mu.php

    r2024 r2026  
    11<?php 
    22function check_upload_size( $file ) { 
     3    if ( get_site_option( 'upload_space_check_disabled' ) ) { 
     4        return $file; 
     5    } 
    36    if( $file['error'] != '0' ) // there's already an error 
    47        return $file; 
     
    380383// Display File upload quota on dashboard 
    381384function dashboard_quota() {     
     385    if ( get_site_option( 'upload_space_check_disabled' ) ) { 
     386        return true; 
     387    } 
    382388    $quota = get_space_allowed(); 
    383389    $used = get_dirsize( BLOGUPLOADDIR )/1024/1024; 
     
    453459*/ 
    454460function wpmu_checkAvailableSpace() { 
     461    if ( get_site_option( 'upload_space_check_disabled' ) ) { 
     462        return true; 
     463    } 
    455464    $spaceAllowed = get_space_allowed(); 
    456465 
     
    475484 
    476485    if( ($spaceAllowed - $size) <= 0 ) { 
    477         define( 'DISABLE_UPLOADS', true ); 
    478         define( 'DISABLE_UPLOADS_MESSAGE', __('Sorry, you must delete files before you can upload any more.') ); 
    479     } 
    480 } 
    481 add_action('upload_files_upload','wpmu_checkAvailableSpace'); 
     486        wp_die( __('Sorry, you must delete files before you can upload any more.') ); 
     487    } 
     488} 
     489add_action('pre-upload-ui','wpmu_checkAvailableSpace'); 
    482490 
    483491function format_code_lang( $code = '' ) { 
  • trunk/wp-admin/wpmu-edit.php

    r2018 r2026  
    3636        } 
    3737        update_site_option( "illegal_names", $names ); 
    38  
    39         update_site_option( "registration", $_POST['registration'] ); 
    40         update_site_option( "registrationnotification", $_POST['registrationnotification'] ); 
    41         update_site_option( "add_new_users", $_POST['add_new_users'] ); 
    4238 
    4339        if( $_POST['limited_email_domains'] != '' ) { 
     
    106102        } 
    107103        update_site_option( "dashboard_blog", $dashboard_blog_id ); 
    108         $options = array( 'menu_items', 'mu_media_buttons', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed' ); 
     104        $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed' ); 
    109105        foreach( $options as $option_name ) { 
    110106            $value = stripslashes_deep( $_POST[ $option_name ] ); 
  • trunk/wp-admin/wpmu-options.php

    r2005 r2026  
    204204                <label><input type='checkbox' id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value='1' <?php if( $mu_media_buttons[ 'audio' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Music' ); ?></label><br /> 
    205205                <?php _e( 'The media upload buttons to display on the "Write Post" page. Make sure you update the "Upload File Types" below as well.' ); ?></td> 
     206            </tr> 
     207            <tr valign="top">  
     208                <th scope="row"><?php _e('Blog upload space check') ?></th>  
     209                <td> 
     210                <label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='0' <?php if( !get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Enabled' ); ?></label><br /> 
     211                <label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='1' <?php if( get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Disabled' ); ?></label><br /> 
     212                <?php _e( 'By default there is a limit on the total size of files uploaded but it can be disabled here.' ); ?></td> 
    206213            </tr> 
    207214            <tr valign="top">  
  • trunk/wp-includes/wpmu-default-filters.php

    r1852 r2026  
    3737add_filter ( 'import_upload_size_limit', 'fix_import_form_size' ); 
    3838add_filter ( 'upload_mimes', 'check_upload_mimes' ); 
    39 add_action ( 'upload_files_upload', 'upload_is_user_over_quota' ); 
    40 add_action ( 'upload_files_browse', 'upload_is_user_over_quota' ); 
    41 add_action ( 'upload_files_browse-all', 'upload_is_user_over_quota' ); 
    4239add_filter ( 'upload_dir', 'fix_upload_details' ); 
    4340 
  • trunk/wp-includes/wpmu-functions.php

    r2025 r2026  
    17091709 
    17101710function upload_is_user_over_quota( $echo = true ) { 
     1711    if ( get_site_option( 'upload_space_check_disabled' ) ) { 
     1712        return true; 
     1713    } 
    17111714    $spaceAllowed = get_space_allowed(); 
    17121715    if(empty($spaceAllowed) || !is_numeric($spaceAllowed)) 
Note: See TracChangeset for help on using the changeset viewer.