function memcache_requirements in Memcache API and Integration 8.2
Same name and namespace in other branches
- 6 memcache.install \memcache_requirements()
- 7 memcache.install \memcache_requirements()
Implements hook_requirements().
File
- ./
memcache.install, line 11 - Install, update and uninstall hooks for the Memcache module.
Code
function memcache_requirements($phase) {
$requirements = [];
$memcache = extension_loaded('memcache');
$memcached = extension_loaded('memcached');
if ($phase == 'install' || $phase == 'runtime') {
if (!$memcache && !$memcached) {
$requirements['memcache_extension']['title'] = t('Memcache');
$requirements['memcache_extension']['severity'] = REQUIREMENT_ERROR;
$requirements['memcache_extension']['value'] = t('Extensions not available');
$requirements['memcache_extension']['description'] = t('Either the <a href="http://php.net/manual/en/book.memcache.php">memcache</a> or <a href="http://php.net/manual/en/book.memcached.php">memcached</a> extensions must be installed in order to use memcache integration.');
}
}
if ($phase == 'runtime') {
if ($memcache) {
// @todo: consider adding minimum version requirement for extensions.
$requirements['memcache_extension_version']['title'] = t('Memcache version');
$requirements['memcache_extension_version']['severity'] = REQUIREMENT_OK;
$requirements['memcache_extension_version']['value'] = phpversion('memcache');
}
if ($memcached) {
$requirements['memcached_extension_version']['title'] = t('Memcached version');
$requirements['memcached_extension_version']['severity'] = REQUIREMENT_OK;
$requirements['memcached_extension_version']['value'] = phpversion('memcached');
}
}
return $requirements;
}