Commit 92483f63 authored by markpavlitski's avatar markpavlitski Committed by Jeremy

Issue #1806120 by markpavlitski: warn if an unsupported PECL version is being used.

parent 2f7f371e
......@@ -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.
......
......@@ -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.
......
......@@ -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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment