summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgit2014-06-03 14:06:27 (GMT)
committerJeremy Andrews2014-06-03 14:06:27 (GMT)
commitc7c0120620fa61bb6dd63083c606f558c4904917 (patch)
tree8f8595b9235047817154cf09183d938b4e6e1a62
parentbb8d0b01e36a376d681edb68bf1d72d55a7a278f (diff)
Issue #2278021 by totosarg, Jeremy: lighten memcache version warning.7.x-1.1-beta67.x-1.0-beta6
-rw-r--r--memcache.install36
1 files changed, 29 insertions, 7 deletions
diff --git a/memcache.install b/memcache.install
index 1ddddc2..64024c6 100644
--- a/memcache.install
+++ b/memcache.install
@@ -13,6 +13,8 @@ define('MEMCACHED_PECL_RECOMMENDED', '2.0.1');
*/
function memcache_enable() {
$error = FALSE;
+ $warning = FALSE;
+ $severity = 'status';
$memcache = extension_loaded('memcache');
$memcached = extension_loaded('memcached');
if (!$memcache && !$memcached) {
@@ -24,7 +26,7 @@ function memcache_enable() {
}
else {
if (!_memcache_version_valid()) {
- $error = TRUE;
+ $warning = TRUE;
}
// Make a test connection to all configured memcache servers.
$memcache_servers = variable_get('memcache_servers', array('127.0.0.1:11211' => 'default'));
@@ -38,9 +40,18 @@ function memcache_enable() {
}
}
}
+
if ($error) {
- drupal_set_message(t('There are problems with your Memcache configuration. Please review %readme and visit the Drupal admin !status page for more information.', array('%readme' => 'README.txt', '!status' => l(t('status report'), 'admin/reports/status'))), 'error');
+ $severity = 'error';
+ }
+ elseif ($warning) {
+ $severity = 'warning';
+ }
+
+ if ($error || $warning) {
+ drupal_set_message($t('There are problems with your Memcache configuration. Please review %readme and visit the Drupal admin !status page for more information.', array('%readme' => 'README.txt', '!status' => l($t('status report'), 'admin/reports/status'))), $severity);
}
+
}
/**
@@ -51,6 +62,7 @@ function memcache_requirements($phase) {
$t = get_t();
$memcache = extension_loaded('memcache');
$memcached = extension_loaded('memcached');
+
if ($phase == 'install' || $phase == 'runtime') {
$requirements['memcache_extension']['title'] = $t('Memcache');
if (!$memcache && !$memcached) {
@@ -60,6 +72,8 @@ function memcache_requirements($phase) {
}
if ($phase == 'runtime') {
$errors = array();
+ $warnings = array();
+
if (!$memcache && !$memcached) {
$errors[] = $t('Required PHP extension not found. Install the <a href="http://php.net/manual/en/book.memcache.php">memcache</a> (recommended) or <a href="http://php.net/manual/en/book.memcached.php">memcached</a> extension.');
}
@@ -86,7 +100,7 @@ function memcache_requirements($phase) {
}
if (!_memcache_version_valid()) {
- $errors[] = $t('PECL !extension version %version is unsupported. Please update to %recommended or newer.', array(
+ $warnings[] = $t('PECL !extension version %version is unsupported. Please update to %recommended or newer.', array(
'!extension' => $extension,
'%version' => $version,
'%recommended' => $recommended,
@@ -128,13 +142,21 @@ function memcache_requirements($phase) {
}
}
- if (empty($errors)) {
- $requirements['memcache_extension']['severity'] = REQUIREMENT_OK;
- }
- else {
+ if (!empty($errors)) {
+ // Error takes precedence over warning, stack together errors and
+ // warnings and display as error messages.
+ $errors = array_merge($errors, $warnings);
+ unset($warnings);
$requirements['memcache_extension']['severity'] = REQUIREMENT_ERROR;
$requirements['memcache_extension']['description'] = $t('There is a problem with your memcache configuration, check the Drupal logs for additional errors. Please review %readme for help resolving the following !issue: !errors', array('%readme' => 'README.txt', '!issue' => format_plural(count($errors), 'issue', 'issues'), '!errors' => '<ul><li>' . implode('<li>', $errors)));
}
+ elseif (!empty($warnings)) {
+ $requirements['memcache_extension']['severity'] = REQUIREMENT_WARNING;
+ $requirements['memcache_extension']['description'] = $t('There is a problem with your memcache configuration. Please review %readme for help resolving the following !issue: !warnings', array('%readme' => 'README.txt', '!issue' => format_plural(count($warnings), 'issue', 'issues'), '!warnings' => '<ul><li>' . implode('<li>', $warnings)));
+ }
+ else {
+ $requirements['memcache_extension']['severity'] = REQUIREMENT_OK;
+ }
}
return $requirements;
}