summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2008-01-04 17:19:04 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2008-01-04 17:19:04 +0000
commitb5e64f5a6ed1c7160a6104097185cc486db3aa95 (patch)
tree0b706cb1408b7eb26720ff9ffbb34436a8f135da /modules
parentd5916e806102a43ec4547b78b5da0f828806bfeb (diff)
downloadbrdo-b5e64f5a6ed1c7160a6104097185cc486db3aa95.tar.gz
brdo-b5e64f5a6ed1c7160a6104097185cc486db3aa95.tar.bz2
#197720 by nedjo, scor, keith.smith, catch: inform installing users about PHP memory requirements of Drupal 6
Diffstat (limited to 'modules')
-rw-r--r--modules/system/system.install18
-rw-r--r--modules/system/system.module5
2 files changed, 23 insertions, 0 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 969821717..8035c8dbe 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -62,6 +62,24 @@ function system_requirements($phase) {
$requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
$requirements['php']['severity'] = REQUIREMENT_ERROR;
}
+
+ // Test PHP memory_limit
+ $requirements['php_memory_limit'] = array(
+ 'title' => $t('PHP memory limit'),
+ 'value' => ini_get('memory_limit') ? ini_get('memory_limit') : '',
+ );
+ if ($phase == 'install') {
+ if (ini_get('memory_limit') && parse_size(ini_get('memory_limit')) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) {
+ $requirements['php_memory_limit']['description'] = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process. If you have access to php.ini you can usually change this setting there. See the <a href="@url">Drupal requirements</a> for more information.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, '@url' => 'http://drupal.org/requirements'));
+ $requirements['php_memory_limit']['severity'] = REQUIREMENT_WARNING;
+ }
+ }
+ elseif ($phase == 'runtime') {
+ if (ini_get('memory_limit') && parse_size(ini_get('memory_limit')) < parse_size(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT)) {
+ $requirements['php_memory_limit']['description'] = $t('Depending on your configuration, Drupal can run with a %memory_limit PHP memory limit. However, a %memory_minimum_limit PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules. If you have access to php.ini you can usually change this setting there. See the <a href="@url">Drupal requirements</a> for more information.', array('%memory_limit' => ini_get('memory_limit'), '%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, '@url' => 'http://drupal.org/requirements'));
+ $requirements['php_memory_limit']['severity'] = REQUIREMENT_WARNING;
+ }
+ }
// Test DB version
global $db_type;
diff --git a/modules/system/system.module b/modules/system/system.module
index 2431ef613..2b962c7b0 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -22,6 +22,11 @@ define('DRUPAL_CORE_COMPATIBILITY', '6.x');
define('DRUPAL_MINIMUM_PHP', '4.3.3');
/**
+ * Minimum recommended value of PHP memory_limit.
+ */
+define('DRUPAL_MINIMUM_PHP_MEMORY_LIMIT', '16M');
+
+/**
* Minimum supported version of MySQL, if it is used.
*/
define('DRUPAL_MINIMUM_MYSQL', '4.1.0');