diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-03 06:40:49 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-03 06:40:49 +0000 |
commit | 0ba31d935055d5c12b5afaf256e5c319366296ef (patch) | |
tree | 51d3ca9bbf14634beccce321c0d35f84aa9c1651 | |
parent | ccf95431994a2cb065bf2de59eee6dd4b4c11878 (diff) | |
download | brdo-0ba31d935055d5c12b5afaf256e5c319366296ef.tar.gz brdo-0ba31d935055d5c12b5afaf256e5c319366296ef.tar.bz2 |
#295697 by boombatower, maartenvg, agentrickard, bfroehle, beeradb: Fixed warn of PHP memory limit < 64MB for Testing module.
-rw-r--r-- | modules/simpletest/simpletest.install | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/simpletest/simpletest.install b/modules/simpletest/simpletest.install index cf43884bc..3da8bcdcc 100644 --- a/modules/simpletest/simpletest.install +++ b/modules/simpletest/simpletest.install @@ -7,9 +7,12 @@ */ /** + * Minimum value of PHP memory_limit for SimpleTest. + */ +define('SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT', '64M'); + +/** * Implements hook_requirements(). - * - * Check that the cURL extension exists for PHP. */ function simpletest_requirements($phase) { $requirements = array(); @@ -58,6 +61,14 @@ function simpletest_requirements($phase) { $requirements['php_open_basedir']['description'] = t('The testing framework requires the PHP <a href="@open_basedir-url">open_basedir</a> restriction to be disabled. Check your webserver configuration or contact your web host.', array('@open_basedir-url' => 'http://php.net/manual/en/ini.core.php#ini.open-basedir')); } + // Check the current memory limit. If it is set too low, SimpleTest will fail + // to load all tests and throw a fatal error. + $memory_limit = ini_get('memory_limit'); + if ($memory_limit && $memory_limit != -1 && parse_size($memory_limit) < parse_size(SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT)) { + $requirements['php_memory_limit']['severity'] = REQUIREMENT_ERROR; + $requirements['php_memory_limit']['description'] = t('The testing framework requires the PHP memory limit to be at least %memory_minimum_limit. The current value is %memory_limit. <a href="@url">Follow these steps to continue</a>.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT, '@url' => 'http://drupal.org/node/207036')); + } + return $requirements; } |