diff --git a/README.txt b/README.txt index 0a77f4799c13cac705c4b476cb570eccc3213b63..a3e816ad54a1bf0f6572eb5ef3877e0b23bd6e42 100644 --- a/README.txt +++ b/README.txt @@ -24,8 +24,8 @@ is important. 2. Install your chosen PECL memcache extension -- this is the memcache client library which will be used by the Drupal memcache module to interact with the memcached server(s). Generally PECL memcache (3.0.6+) is recommended, - but PECL memcached (2.0.1+) also works well for some people. Use of older - versions may cause problems. + but PECL memcached (2.0.1+) also works well for some people. There are + known issues with older version. 3. Put your site into offline mode. 4. Download and install the memcache module. 5. If you have previously been running the memcache module, run update.php. diff --git a/memcache.install b/memcache.install index 26b1a1cf88c068fc4f23ac4ca2f75e4c290188fd..950ffb38aea211f64682a262ddaba3e074de875b 100644 --- a/memcache.install +++ b/memcache.install @@ -5,6 +5,9 @@ * Install, update and uninstall functions for the memcache module. */ +define('MEMCACHE_PECL_RECOMMENDED', '3.0.6'); +define('MEMCACHED_PECL_RECOMMENDED', '2.0.1'); + /** * Implements hook_enable(). */ @@ -65,10 +68,22 @@ function memcache_requirements($phase) { else { $extension = dmemcache_extension(); if ($extension == 'Memcache') { - $requirements['memcache_extension']['value'] = phpversion('memcache') . _memcache_statistics_link(); + $version = phpversion('memcache'); + $recommended = MEMCACHE_PECL_RECOMMENDED; + $requirements['memcache_extension']['value'] = $version . _memcache_statistics_link(); } elseif ($extension == 'Memcached') { - $requirements['memcache_extension']['value'] = phpversion('memcached') . _memcache_statistics_link(); + $version = phpversion('memcached'); + $recommended = MEMCACHED_PECL_RECOMMENDED; + $requirements['memcache_extension']['value'] = $version . _memcache_statistics_link(); + } + + if (version_compare($version, $recommended, '<')) { + $errors[] = $t('PECL !extension version %version is unsupported. Please update to %recommended or newer.', array( + '!extension' => $extension, + '%version' => $version, + '%recommended' => $recommended, + )); } // Make a test connection to all configured memcache servers. diff --git a/tests/memcache.test b/tests/memcache.test index de956f0ab01b55f29767d9f75241f43d597e7e16..ed7ad0b78da4e2d3be834fb6b5280c679979b190 100644 --- a/tests/memcache.test +++ b/tests/memcache.test @@ -327,6 +327,17 @@ class MemCacheSavingCase extends MemcacheTestCase { $this->checkVariable($this->randomName(100), 'Qwerty!@#$%^&*()_+-=[]\;\',./<>?:"{}|£¢'); } + /** + * Test saving and restoring an integer value directly with dmemcache_set(). + */ + function testIntegerValue() { + $key = $this->randomName(100); + $val = rand(1, 1000); + dmemcache_set($key, $val, 0, 'cache'); + $cache = dmemcache_get($key, 'cache'); + $this->assertTrue($val === $cache, t('Integer is saved and restored properly with key @key', array('@key' => $key))); + } + /** * Check or a variable is stored and restored properly. */