Skip to content

Commit

Permalink
Added support for command renaming
Browse files Browse the repository at this point in the history
Support limited to one Redis instance
Fix for issue moodle-an-hochschulen#8
  • Loading branch information
slaudel committed Jan 24, 2024
1 parent 7ad3fb0 commit e0f9eb0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------
Expand Down
11 changes: 10 additions & 1 deletion lib/redis-stats/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e0f9eb0

Please sign in to comment.