From ed2de2ecc7d5adcde020f61378da315781bc049a Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 23 Jul 2014 15:16:20 +1200 Subject: [PATCH] MDL-45724 cache: fixed warning structure bug --- cache/admin.php | 6 +++++- cache/classes/store.php | 6 +----- cache/stores/memcache/lib.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cache/admin.php b/cache/admin.php index 827b13719e3..775ce25ff36 100644 --- a/cache/admin.php +++ b/cache/admin.php @@ -280,7 +280,11 @@ if (!empty($action) && confirm_sesskey()) { } } -$notifications = array_merge($notifications, cache_helper::warnings($stores)); +// Add cache store warnings to the list of notifications. +// Obviously as these are warnings they are show as failures. +foreach (cache_helper::warnings($stores) as $warning) { + $notifications[] = array($warning, false); +} $PAGE->set_title($title); $PAGE->set_heading($SITE->fullname); diff --git a/cache/classes/store.php b/cache/classes/store.php index 464df843d3b..9d124d3d644 100644 --- a/cache/classes/store.php +++ b/cache/classes/store.php @@ -372,11 +372,7 @@ abstract class cache_store implements cache_store_interface { * This should be used to notify things like configuration conflicts etc. * The warnings returned here will be displayed on the cache configuration screen. * - * @return array[] Returns an array of arrays with the format: - * $notifications = array( - * array('This is a success message', true), - * array('This is a failure message', false), - * ); + * @return string[] An array of warning strings from the store instance. */ public function get_warnings() { return array(); diff --git a/cache/stores/memcache/lib.php b/cache/stores/memcache/lib.php index 036da565668..aa5c15d0827 100644 --- a/cache/stores/memcache/lib.php +++ b/cache/stores/memcache/lib.php @@ -589,7 +589,7 @@ class cachestore_memcache extends cache_store implements cache_is_configurable { $host = array_shift($bits); $port = (count($bits)) ? array_shift($bits) : '11211'; foreach ($this->servers as $server) { - if ($server[0] === $host && $server[1] === $port) { + if ($server[0] === $host && $server[1] == $port) { $warnings[] = get_string('sessionhandlerconflict', 'cachestore_memcache', $this->my_name()); break; }