From ab8c557b78f494a55d7659013fee040b32f77d76 Mon Sep 17 00:00:00 2001 From: OverlordQ Date: Wed, 5 Aug 2009 02:34:41 +0000 Subject: [PATCH] Followup to r54416 Dont log messages when you 'increase' the limit from a number to itself. --- config/index.php | 10 +++++----- includes/GlobalFunctions.php | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/config/index.php b/config/index.php index 4f6cd28a80..0722588dd1 100644 --- a/config/index.php +++ b/config/index.php @@ -466,16 +466,16 @@ if( !function_exists( 'preg_match' ) ) Perl-compatible regular expression functions." ); $memlimit = ini_get( "memory_limit" ); -$newlimit = wfMemoryLimit(); -global $wgMemoryLimit; if( $memlimit == -1 ) { print "
  • PHP is configured with no memory_limit.
  • \n"; } else { print "
  • PHP's memory_limit is " . htmlspecialchars( $memlimit ). " bytes. "; - if( $newlimit >= $wgMemoryLimit ) { - print "Successfully set limit to " . htmlspecialchars( $newlimit ) . "... "; - } else { + $newlimit = wfMemoryLimit(); + $memlimit = wfShorthandToInteger( $memlimit ); + if( $newlimit < $memlimit ) { print "Failed raising limit, installation may fail."; + } elseif ( $newlimit > $memlimit ) { + print "Raised memory_limit to " . htmlspecialchars( $newlimit ) . " bytes. "; } print "
  • \n"; } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 77daed3859..b66589a128 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3209,13 +3209,12 @@ function wfMemoryLimit () { ini_set( "memory_limit", $conflimit ); wfRestoreWarnings(); return $conflimit; - } else { - $max = max( $memlimit, $conflimit ); - wfDebug( "Raising PHP's memory limit to $max bytes\n" ); + } elseif ( $conflimit > $memlimit ) { + wfDebug( "Raising PHP's memory limit to $conflimit bytes\n" ); wfSuppressWarnings(); - ini_set( "memory_limit", $max ); + ini_set( "memory_limit", $conflimit ); wfRestoreWarnings(); - return $max; + return $conflimit; } } return $memlimit; -- 2.20.1