From 82668db3de3e67d47e038d34f588fcf8c10682de Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Mon, 2 Jan 2017 13:01:02 +0200 Subject: [PATCH] Bug 17833 - _initilize_memcached() warns if errors Content-Type: text/plain; charset=utf-8 If memcached or the connection to it is misconfigured, show simple warnings to help identify the problem. Signed-off-by: Katrin Fischer Signed-off-by: Marcel de Rooy --- Koha/Cache.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/Cache.pm b/Koha/Cache.pm index 5af8c0e..5bab842 100644 --- a/Koha/Cache.pm +++ b/Koha/Cache.pm @@ -139,9 +139,13 @@ sub _initialize_memcached { utf8 => 1, } ); + # Ensure we can actually talk to the memcached server my $ismemcached = $memcached->set('ismemcached','1'); - return $self unless $ismemcached; + unless ($ismemcached) { #Value is undefined or False, so there was an error with the server, the connection to it, or a protocol error + warn "Connection to the memcached servers '@servers' failed. Are the unix socket permissions set properly? Is the host reachable?"; + return $self; + } $self->{'memcached_cache'} = $memcached; return $self; } -- 2.1.4