Skip to content

Commit

Permalink
Merge branch 'MDL-66546' of https://github.com/mcabro/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
HuongNV13 committed Nov 8, 2023
2 parents 4df21a5 + 63a7ce5 commit 4e112d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions cache/stores/redis/addinstanceform.php
Expand Up @@ -43,6 +43,7 @@ protected function configuration_definition() {
$form->setType('server', PARAM_TEXT);
$form->addHelpButton('server', 'server', 'cachestore_redis');
$form->addRule('server', get_string('required'), 'required');
$form->addElement('static', 'server_desc', '', get_string('server_desc', 'cachestore_redis'));

$form->addElement('advcheckbox', 'encryption', get_string('encrypt_connection', 'cachestore_redis'));
$form->setType('encryption', PARAM_BOOL);
Expand Down
5 changes: 3 additions & 2 deletions cache/stores/redis/lang/en/cachestore_redis.php
Expand Up @@ -42,12 +42,13 @@
$string['serializer_igbinary'] = 'The igbinary serializer.';
$string['serializer_php'] = 'The default PHP serializer.';
$string['server'] = 'Server';
$string['server_help'] = 'This sets the hostname or IP address of the Redis server to use.';
$string['server_desc'] = 'For Unix socket usage, use the format <strong>/var/redis.sock</strong> or <strong>unix:///var/redis.sock</strong>';
$string['server_help'] = 'This sets the hostname, IP address or Unix socket path of the Redis server to use.';
$string['password'] = 'Password';
$string['password_help'] = 'This sets the password of the Redis server.';
$string['task_ttl'] = 'Free up memory used by expired entries in Redis caches';
$string['test_server'] = 'Test server';
$string['test_server_desc'] = 'Redis server to use for testing.';
$string['test_server_desc'] = 'Redis server to use for testing.<br>For Unix socket usage, use the format <strong>/var/redis.sock</strong> or <strong>unix:///var/redis.sock</strong>';
$string['test_password'] = 'Test server password';
$string['test_password_desc'] = 'Redis test server password.';
$string['test_serializer'] = 'Serializer';
Expand Down
3 changes: 2 additions & 1 deletion cache/stores/redis/lib.php
Expand Up @@ -217,7 +217,8 @@ protected function new_redis(array $configuration): \Redis {
// Check if it isn't a Unix socket to set default port.
$port = null;
$opts = [];
if ($server[0] === '/') {
// Unix sockets can start with / or with unix://.
if ($server[0] === '/' || strpos($server, 'unix://') === 0) {
$port = 0;
} else {
$port = 6379; // No Unix socket so set default port.
Expand Down

0 comments on commit 4e112d7

Please sign in to comment.