Make WordPress Core

Changeset 21165


Ignore:
Timestamp:
06/28/2012 08:14:39 PM (12 years ago)
Author:
nacin
Message:

Respect -1 as a memory limit setting.

Don't override memory_limit = -1 with a fixed value.
Know that WP_MEMORY_LIMIT = -1 can override a fixed value.

props aaroncampbell
fixes #14889

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-constants.php

    r19771 r21165  
    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') )
Note: See TracChangeset for help on using the changeset viewer.