mirror of
https://github.com/cytopia/devilbox.git
synced 2025-04-12 13:27:50 +00:00
Use preg_match_all to get redis password from args
This should fix the issue where preg_split was being used and would cause an error if the redis args variable didn't contain the --requirepass string and the WebGUI wouldn't load as a result.
This commit is contained in:
parent
f6bbdc72fd
commit
5e90a3a35d
@ -132,10 +132,14 @@ function loadClass($class) {
|
||||
$REDIS_ROOT_PASSWORD = '';
|
||||
|
||||
$_REDIS_ARGS = loadClass('Helper')->getEnv('REDIS_ARGS');
|
||||
$_REDIS_PASS = preg_split("/--requirepass\s+/", $_REDIS_ARGS);
|
||||
if (is_array($_REDIS_PASS) && count($_REDIS_PASS)) {
|
||||
|
||||
$_REDIS_PASS = [];
|
||||
preg_match_all('/--requirepass\s+([^\s]*)/', $_REDIS_ARGS, $_REDIS_PASS);
|
||||
|
||||
if (! empty($_REDIS_PASS[1])) {
|
||||
// In case the option is specified multiple times, use the last effective one.
|
||||
$_REDIS_PASS = $_REDIS_PASS[count($_REDIS_PASS)-1];
|
||||
$_REDIS_PASS = end($_REDIS_PASS[1]);
|
||||
|
||||
if (strlen($_REDIS_PASS) > 0) {
|
||||
$REDIS_ROOT_PASSWORD = $_REDIS_PASS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user