function _memcache_pecl_version_valid in Memcache API and Integration 7
Validate whether the current PECL version is supported.
2 calls to _memcache_pecl_version_valid()
- memcache_enable in ./
memcache.install - Implements hook_enable().
- memcache_requirements in ./
memcache.install - Implements hook_requirements().
File
- ./
memcache.install, line 262 - Install, update and uninstall functions for the memcache module.
Code
function _memcache_pecl_version_valid() {
$extension = dmemcache_extension();
if ($extension == 'Memcache') {
// The latest PECL Memcache releases are using a 4 digit version
// which version_compare doesn't support. At this time the 4th
// digit isn't important to us, so we just look at the first 3
// digits. If a future release requires 4 digit precision
// it will require a replacement for version_compare().
$full_version = phpversion('memcache');
$version = implode('.', array_slice(explode('.', $full_version), 0, 3));
if (version_compare(phpversion(), '7' . '>=')) {
return version_compare($version, MEMCACHE_PECL_PHP7_RECOMMENDED, '>=');
}
else {
return version_compare($version, MEMCACHE_PECL_RECOMMENDED, '>=');
}
}
elseif ($extension == 'Memcached') {
return version_compare(phpversion('memcached'), MEMCACHED_PECL_RECOMMENDED, '>=');
}
}