Make WordPress Core

Ticket #13575: 13575.5.diff

File 13575.5.diff, 833 bytes (added by antpb, 10 years ago)
  • src/wp-admin/includes/template-functions.php

     
    821821         * @param int $max_upload_size Allowed upload size. Default 1 MB.
    822822         */
    823823        $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
     824
     825        if ( function_exists( 'memory_get_usage' ) ) {
     826                $current = ini_get( 'memory_limit' );
     827                ini_restore( 'memory_limit' );
     828                $memory_limit = ini_set( 'memory_limit',  $current );
     829                $m_bytes = size_format( $memory_limit );
     830                $bytes = ( -1 === $m_bytes ) ? $bytes : min( $bytes, $m_bytes );
     831        }
     832
    824833        $size = size_format( $bytes );
    825834        $upload_dir = wp_upload_dir();
    826835        if ( ! empty( $upload_dir['error'] ) ) :