Fix #1602 support username/password for Redis cache

This commit is contained in:
Kijin Sung 2021-02-05 21:01:04 +09:00
parent 80b235001e
commit 2f0b6433bc
6 changed files with 22 additions and 3 deletions

View file

@ -559,6 +559,8 @@ class adminAdminView extends admin
{
Context::set('object_cache_host', parse_url(array_first($cache_servers), PHP_URL_HOST) ?: null);
Context::set('object_cache_port', parse_url(array_first($cache_servers), PHP_URL_PORT) ?: null);
Context::set('object_cache_user', parse_url(array_first($cache_servers), PHP_URL_USER) ?: null);
Context::set('object_cache_pass', parse_url(array_first($cache_servers), PHP_URL_PASS) ?: null);
$cache_dbnum = preg_replace('/[^\d]/', '', parse_url(array_first($cache_servers), PHP_URL_FRAGMENT) ?: parse_url(array_first($cache_servers), PHP_URL_PATH));
Context::set('object_cache_dbnum', $cache_dbnum === '' ? 1 : intval($cache_dbnum));
}