From 76094dd9fc5294f33b1ca15d71f8e1dd0ae6232e Mon Sep 17 00:00:00 2001
From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Date: Mon, 2 Jan 2017 13:01:02 +0200
Subject: [PATCH] Bug 17833 - _initilize_memcached() warns if errors

If memcached or the connection to it is misconfigured, show simple warnings to help
identify the problem.
---
 Koha/Cache.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Koha/Cache.pm b/Koha/Cache.pm
index 80ff1ca..99caa3c 100644
--- a/Koha/Cache.pm
+++ b/Koha/Cache.pm
@@ -146,9 +146,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.7.4