Skip to content

Commit 17dc3ff

Browse files
authored
Update config.php
Check server address and port for unix socket
1 parent 7ad3fb0 commit 17dc3ff

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/redis-stats/config.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,23 @@
6060
continue;
6161
}
6262

63+
// First need to check server connection string: if no port and using non tcp unix socket - ommit port and add 'unix://'
64+
// Do it like in /cache/stores/redis/lib.php:new_redis()
65+
$server = $store['configuration']['server'];
66+
$port = 6379;
67+
if ($server[0] === '/') {
68+
$port = 0;
69+
$server = 'unix://' . $server;
70+
} else {
71+
if (strpos($server, ':')) { // Check for custom port.
72+
$serverconf = explode(':', $server);
73+
$server = $serverconf[0];
74+
$port = $serverconf[1];
75+
}
76+
}
77+
6378
// Remember the Redis store information.
64-
$servers[] = [$store['name'], $store['configuration']['server'], 6379, $store['configuration']['password']];
79+
$servers[] = [$store['name'], $server, $port, $store['configuration']['password']];
6580
}
6681

6782
// Forth: If there isn't any Redis store configured, we should stop here.

0 commit comments

Comments
 (0)