Make WordPress Core

Ticket #14889: 14889.2.diff

File 14889.2.diff, 881 bytes (added by aaroncampbell, 15 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 && ( -1 == WP_MEMORY_LIMIT || ( inval( $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