diff --git a/README.md b/README.md index f91f139..f9e9d6b 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,16 @@ Site administration -> Server -> Redis management. The Redis management GUI should be self-explanatory for experienced PHP administrators. +As the Moodle Cache Plugin for REDIS doesn't support command renaming, you need an additional entry in config.php. +It has to be in the following form: +``` +$CFG->cache_redis = array( + 'cache_instance' => 'NAME OF INSTANCE', + 'INFO' => 'RENAMED INFO COMMAND', + 'AUTH' => 'RENAMED AUTH COMMAND', +); +``` +You can choose one of 'INFO' and 'AUTH' or both. Capabilities ------------ diff --git a/lib/redis-stats/config.php b/lib/redis-stats/config.php index 54444a1..eb9e295 100644 --- a/lib/redis-stats/config.php +++ b/lib/redis-stats/config.php @@ -61,7 +61,16 @@ } // Remember the Redis store information. - $servers[] = [$store['name'], $store['configuration']['server'], 6379, $store['configuration']['password']]; + $server_info = explode(":", $store['configuration']['server']); + $servers[] = [$store['name'], $server_info[0], $server_info[1] ?? 6379, $store['configuration']['password']]; +} +if (isset($CFG->cache_redis) && !is_null($CFG->cache_redis) && !empty($CFG->cache_redis)) { + if (isset($CFG->cache_redis['INFO']) && !is_null($CFG->cache_redis['INFO']) && !empty($CFG->cache_redis['INFO'])) { + $command[$CFG->cache_redis['cache_instance']]['INFO'] = $CFG->cache_redis['INFO']; + } + if (isset($CFG->cache_redis['AUTH']) && !is_null($CFG->cache_redis['AUTH']) && !empty($CFG->cache_redis['AUTH'])) { + $command[$CFG->cache_redis['cache_instance']]['AUTH'] = $CFG->cache_redis['AUTH']; + } } // Forth: If there isn't any Redis store configured, we should stop here.