function _check_ascii_auth in Memcache API and Integration 7
Check that ascii authentication is setup correctly.
Parameters
string $memcache_original: The memcache object whose servers will be checked.
Return value
TRUE|array TRUE on success, the failed server and the error message on failure.
1 call to _check_ascii_auth()
- memcache_requirements in ./
memcache.install - Implements hook_requirements().
File
- ./
memcache.install, line 321 - Install, update and uninstall functions for the memcache module.
Code
function _check_ascii_auth($memcache_original) {
$servers = $memcache_original
->getServerList();
foreach ($servers as $s) {
// Note: This intentionally does not use a persistent id.
$mc = new Memcached();
$mc
->addServer($s['host'], $s['port']);
// Check that a set() / get() with a fresh connection fails.
$mc
->set(DRUPAL_MEMCACHE_ASCII_AUTH_LIFETIME_KEY, TRUE);
$rc = $mc
->get(DRUPAL_MEMCACHE_ASCII_AUTH_LIFETIME_KEY);
if ($rc) {
return [
$s,
t('ASCII authentication not enabled on server'),
];
}
$rc = _dmemcache_ensure_ascii_auth("0", $mc);
if (!$rc) {
return [
$s,
t('ASCII authentication failed'),
];
}
}
return TRUE;
}