WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/21/2015 02:02:59 PM (5 years ago)
Author:
DrewAPicture
Message:

Filesystem: Following the introduction of the KB|MB|GB|TB_IN_BYTES constants in [35286], use them in various places in core.

Props sudar.
Fixes #22405.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r35189 r35325  
    18751875        return $upload;
    18761876
    1877     if ( strlen( $upload['bits'] )  > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
    1878         return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ));
     1877    if ( strlen( $upload['bits'] )  > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
     1878        return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) );
     1879    }
    18791880
    18801881    return $upload;
     
    22792280    if ( false === $space_used ) {
    22802281        $upload_dir = wp_upload_dir();
    2281         $space_used = get_dirsize( $upload_dir['basedir'] ) / 1024 / 1024;
     2282        $space_used = get_dirsize( $upload_dir['basedir'] ) / MB_IN_BYTES;
    22822283    }
    22832284
     
    23232324        $allowed = 0;
    23242325    }
    2325     $space_allowed = $allowed * 1024 * 1024;
     2326    $space_allowed = $allowed * MB_IN_BYTES;
    23262327    if ( get_site_option( 'upload_space_check_disabled' ) )
    23272328        return $space_allowed;
    23282329
    2329     $space_used = get_space_used() * 1024 * 1024;
     2330    $space_used = get_space_used() * MB_IN_BYTES;
    23302331
    23312332    if ( ( $space_allowed - $space_used ) <= 0 )
     
    23542355 */
    23552356function upload_size_limit_filter( $size ) {
    2356     $fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 );
     2357    $fileupload_maxk = KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 );
    23572358    if ( get_site_option( 'upload_space_check_disabled' ) )
    23582359        return min( $size, $fileupload_maxk );
Note: See TracChangeset for help on using the changeset viewer.