cvs: pear /PhpDocumentor/phpDocumentor Setup.inc.php

From: Date: Wed, 07 Feb 2007 19:16:36 +0000
Subject: cvs: pear /PhpDocumentor/phpDocumentor Setup.inc.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44576@lists.php.net to get a copy of this message
ashnazg Wed Feb 7 19:16:36 2007 UTC Modified files: /pear/PhpDocumentor/phpDocumentor Setup.inc.php Log: fix sourceforge bug [1647423] memory_limit: bad if-clause http://cvs.php.net/viewvc.cgi/pear/PhpDocumentor/phpDocumentor/Setup.inc.php?r1=1.15&r2=1.16&diff_format=u Index: pear/PhpDocumentor/phpDocumentor/Setup.inc.php diff -u pear/PhpDocumentor/phpDocumentor/Setup.inc.php:1.15 pear/PhpDocumentor/phpDocumentor/Setup.inc.php:1.16 --- pear/PhpDocumentor/phpDocumentor/Setup.inc.php:1.15 Wed Jan 10 20:57:43 2007 +++ pear/PhpDocumentor/phpDocumentor/Setup.inc.php Wed Feb 7 19:16:36 2007 @@ -30,7 +30,7 @@ * @author Gregory Beaver <cellog@php.net> * @copyright 2002-2006 Gregory Beaver * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @version CVS: $Id: Setup.inc.php,v 1.15 2007/01/10 20:57:43 ashnazg Exp $ + * @version CVS: $Id: Setup.inc.php,v 1.16 2007/02/07 19:16:36 ashnazg Exp $ * @link http://www.phpdoc.org * @link http://pear.php.net/PhpDocumentor * @since 1.2 @@ -391,21 +391,58 @@ /** * Allow a memory_limit setting in phpDocumentor.ini to override php.ini or default memory limit - */ + * @todo recognize "K" and "G" in memory_limit settings, rather than just "M" + */ function setMemoryLimit() { global $_phpDocumentor_options; $DEFAULT_MEMORY_SIZE_MINIMUM = 256; + // PhpDoc memory_limit from phpDocumentor.ini overrides all other considerations if (isset($_phpDocumentor_options['memory_limit'])) { - // PhpDoc memory_limit from phpDocumentor.ini overrides all other considerations - $memory_setting_to_use = str_replace('M', '', $_phpDocumentor_options['memory_limit']); + $phpdoc_ini_setting = str_replace('M', '', $_phpDocumentor_options['memory_limit']); + + // allow phpdoc.ini to DISABLE the setting via "= -1" + if ($phpdoc_ini_setting == -1) + { + $memory_setting_to_use = $phpdoc_ini_setting; + $max_mem_log_message = "setting disabled by phpDocumentor.ini...\n"; + } + else + { + $memory_setting_to_use = $phpdoc_ini_setting . "M"; + $max_mem_log_message = "set at " . $memory_setting_to_use . " by phpDocumentor.ini...\n"; + } } else { - // PHP memory_limit from php.ini must be at least the default minimum $php_ini_setting = str_replace('M', '', ini_get('memory_limit')); - $memory_setting_to_use = ($php_ini_setting > $DEFAULT_MEMORY_SIZE_MINIMUM) ? $php_ini_setting : $DEFAULT_MEMORY_SIZE_MINIMUM; + + // allow php.ini to DISABLE the setting via "= -1" + if ($php_ini_setting == -1) + { + // allow it to remain disabled + $memory_setting_to_use = $php_ini_setting; + $max_mem_log_message = "setting disabled by php.ini...\n"; + } + else + { + // memory_limit from php.ini must be at least the default minimum + $memory_setting_to_use = ($php_ini_setting > $DEFAULT_MEMORY_SIZE_MINIMUM) ? $php_ini_setting . "M" : $DEFAULT_MEMORY_SIZE_MINIMUM . "M"; + $max_mem_log_message = "set at " . $memory_setting_to_use . " after considering php.ini...\n"; + } + } + if (ini_set("memory_limit", $memory_setting_to_use)) + { + // PHP had to have been compiled with "--enable-memory-limit" to allow setting the value explicitly + phpDocumentor_out("Maximum memory usage " . $max_mem_log_message); + } + else + { + // PHP must not have been compiled with "--enable-memory-limit", so we cannot modify it... + // no need to notify user of this unless they tried using memory_limit in their phpDocumentor.ini... + if (isset($phpdoc_ini_setting)) + { + phpDocumentor_out("Unable to alter memory_limit via your phpDocumentor.ini... perhaps PHP wasn't compiled with \"--enable-memory-limit\"?\n"); + } } - ini_set("memory_limit", $memory_setting_to_use . "M"); - phpDocumentor_out("Maximum memory usage set at " . $memory_setting_to_use . "M...\n"); } function setJavadocDesc()

« previous php.pear.cvs (#44576) next »