summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Andrews2014-03-10 01:10:13 (GMT)
committerJeremy Andrews2014-03-10 01:10:13 (GMT)
commit27c2d0a9efd42906d0fdc40be493e2ccfcc9c747 (patch)
treebd2a4480a5e2b3840ca4871e112387d65e50a9ed
parent92483f639ff80d01c5995ba193129503be121362 (diff)
Issue #1806120 by Jeremy: check PECL version on install.
-rw-r--r--memcache.install24
1 files changed, 22 insertions, 2 deletions
diff --git a/memcache.install b/memcache.install
index 950ffb3..1ddddc2 100644
--- a/memcache.install
+++ b/memcache.install
@@ -23,6 +23,9 @@ function memcache_enable() {
$error = TRUE;
}
else {
+ if (!_memcache_version_valid()) {
+ $error = TRUE;
+ }
// Make a test connection to all configured memcache servers.
$memcache_servers = variable_get('memcache_servers', array('127.0.0.1:11211' => 'default'));
$memcache = dmemcache_instance();
@@ -70,15 +73,19 @@ function memcache_requirements($phase) {
if ($extension == 'Memcache') {
$version = phpversion('memcache');
$recommended = MEMCACHE_PECL_RECOMMENDED;
- $requirements['memcache_extension']['value'] = $version . _memcache_statistics_link();
}
elseif ($extension == 'Memcached') {
$version = phpversion('memcached');
$recommended = MEMCACHED_PECL_RECOMMENDED;
+ }
+ if ($version) {
$requirements['memcache_extension']['value'] = $version . _memcache_statistics_link();
}
+ else {
+ $version = $t('unknown');
+ }
- if (version_compare($version, $recommended, '<')) {
+ if (!_memcache_version_valid()) {
$errors[] = $t('PECL !extension version %version is unsupported. Please update to %recommended or newer.', array(
'!extension' => $extension,
'%version' => $version,
@@ -147,6 +154,19 @@ function _memcache_statistics_link() {
}
/**
+ * Validate whether the current PECL version is supported.
+ */
+function _memcache_version_valid() {
+ $extension = dmemcache_extension();
+ if ($extension == 'Memcache') {
+ return version_compare(phpversion('memcache'), MEMCACHE_PECL_RECOMMENDED, '>=');
+ }
+ elseif ($extension == 'Memcached') {
+ return version_compare(phpversion('memcached'), MEMCACHED_PECL_RECOMMENDED, '>=');
+ }
+}
+
+/**
* Remove the memcache_widlcard_flushes variable since its structure has changed.
*/
function memcache_update_7000() {