Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Redis command renaming #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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