diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc index 94d30cf880ee1ff5c67b3936d26f7bae05a2e980..753b4a9d5a22ac4937b21d4372bcea6ab51521c5 100644 --- a/includes/theme.maintenance.inc +++ b/includes/theme.maintenance.inc @@ -124,6 +124,13 @@ function theme_install_page($content) { $variables['messages'] .= theme('status_messages', 'error'); $variables['content'] .= '

'. st('Please check the error messages and try again.', array('!url' => request_uri())) .'

'; } + + // Special handling of warning messages + if (isset($messages['warning'])) { + $title = count($messages['warning']) > 1 ? st('The following installation warnings should be carefully reviewed.') : st('The following installation warning should be carefully reviewed.'); + $variables['messages'] .= '

'. $title .':

'; + $variables['messages'] .= theme('status_messages', 'warning'); + } // Special handling of status messages if (isset($messages['status'])) { diff --git a/install.php b/install.php index 70087c883acdc6107555c4c6c67db375a3fc8402..4264931505b3bf67a0dca4dbb3fd3bc4c0211176 100644 --- a/install.php +++ b/install.php @@ -901,6 +901,18 @@ function install_check_requirements($profile, $verify) { } } } + if ($severity == REQUIREMENT_WARNING) { + + foreach ($requirements as $requirement) { + if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_WARNING) { + $message = $requirement['description']; + if (isset($requirement['value']) && $requirement['value']) { + $message .= ' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')'; + } + drupal_set_message($message, 'warning'); + } + } + } } /** diff --git a/modules/system/system.install b/modules/system/system.install index 969821717e6d148d38e79a29fbfbf45f2c3c1223..8035c8dbe2babdc65dadc6b1f00e5f9741bd7c3d 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 Drupal requirements 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 Drupal requirements 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 2431ef61359241f2f5a0b3e999f6cce19506c950..2b962c7b0b830338f941c77d8eddbc2cf23d931e 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -21,6 +21,11 @@ */ 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. */