-
Notifications
You must be signed in to change notification settings - Fork 0
/
memcache.install
35 lines (30 loc) · 1.4 KB
/
memcache.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* 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']['severity'] = REQUIREMENT_ERROR;
$requirements['memcache_extension']['title'] = t('Extensions not available');
$requirements['memcache_extension']['value'] = 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']['severity'] = REQUIREMENT_OK;
$requirements['memcache_extension_version']['title'] = t('Memcache version');
$requirements['memcache_extension_version']['value'] = phpversion('memcache');
}
if ($memcached) {
$requirements['memcached_extension_version']['severity'] = REQUIREMENT_OK;
$requirements['memcached_extension_version']['title'] = t('Memcached version');
$requirements['memcached_extension_version']['value'] = phpversion('memcached');
}
}
return $requirements;
}