memcache.install in Memcache API and Integration 8.2
Same filename and directory in other branches
Install, update and uninstall hooks for the Memcache module.
File
memcache.installView source
<?php
/**
* @file
* Install, update and uninstall hooks for the Memcache module.
*/
/**
* Implements hook_requirements().
*/
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;
}
Functions
Name | Description |
---|---|
memcache_requirements | Implements hook_requirements(). |