WordPress.org

Make WordPress Core

Ticket #14889: 14889.diff

File 14889.diff, 851 bytes (added by nacin, 7 years ago)
  • wp-includes/default-constants.php

     
    3939                $blog_id = 1;
    4040
    4141        // set memory limits.
    42         if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
    43                 @ini_set('memory_limit', WP_MEMORY_LIMIT);
     42        if ( function_exists('memory_get_usage') ) {
     43                $current_limit = @ini_get('memory_limit');
     44                if ( -1 != $current_limit && intval( $current_limit ) < abs( intval( WP_MEMORY_LIMIT ) ) )
     45                        @ini_set( 'memory_limit', WP_MEMORY_LIMIT );
     46        }
    4447
    4548        if ( !defined('WP_CONTENT_DIR') )
    4649                define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down