From d9ac9596483a198af79ee3ad987e9d0247eb75ee Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Mon, 2 Jan 2017 13:01:02 +0200 Subject: [PATCH] Bug 17833: Add a warning if memcached init failed 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 Signed-off-by: Jonathan Druart --- Koha/Cache.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/Cache.pm b/Koha/Cache.pm index 5af8c0ea32..5bab84263a 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.39.5