From d532386fd0fdb60f7665d93ccbff369fed7979ba Mon Sep 17 00:00:00 2001
From: Hans Kuijpers <info@hkweb.nl>
Date: Thu, 10 Apr 2014 12:23:27 +0200
Subject: [PATCH] added authentication to connect with Redis

I have to use authentication to connect with Redis. (hosting is using PHPRedis instead of PRedis)
---
 object-cache.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/object-cache.php b/object-cache.php
index 3f62404..d5fbac3 100644
--- a/object-cache.php
+++ b/object-cache.php
@@ -320,6 +320,9 @@ class WP_Object_Cache {
 		if ( defined( 'WP_REDIS_BACKEND_PORT' ) && WP_REDIS_BACKEND_PORT ) {
 			$redis['port'] = WP_REDIS_BACKEND_PORT;
 		}
+		if ( defined( 'WP_REDIS_BACKEND_AUTH' ) && WP_REDIS_BACKEND_AUTH ) {
+			$redis['auth'] = WP_REDIS_BACKEND_AUTH;
+		}
 		if ( defined( 'WP_REDIS_BACKEND_DB' ) && WP_REDIS_BACKEND_DB ) {
 			$redis['database'] = WP_REDIS_BACKEND_DB;
 		}
@@ -329,6 +332,10 @@ class WP_Object_Cache {
 			try {
 				$this->redis = new Redis();
 				$this->redis->connect( $redis['host'], $redis['port'] );
+				
+				if ( isset( $redis['auth'] ) ) {
+					$this->redis->auth( $redis['auth'] );
+				}
 
 				if ( isset( $redis['database'] ) ) {
 					$this->redis->select( $redis['database'] );
-- 
GitLab