mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Fix #1602 support username/password for Redis cache
This commit is contained in:
parent
80b235001e
commit
2f0b6433bc
6 changed files with 22 additions and 3 deletions
|
|
@ -801,7 +801,15 @@ class adminAdminController extends admin
|
|||
}
|
||||
else
|
||||
{
|
||||
$cache_servers = array($vars->object_cache_type . '://' . $vars->object_cache_host . ':' . intval($vars->object_cache_port));
|
||||
if (trim($vars->object_cache_user) !== '' || trim($vars->object_cache_pass) !== '')
|
||||
{
|
||||
$auth = sprintf('%s:%s@', urlencode(trim($vars->object_cache_user)), urlencode(trim($vars->object_cache_pass)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$auth = '';
|
||||
}
|
||||
$cache_servers = array($vars->object_cache_type . '://' . $auth . $vars->object_cache_host . ':' . intval($vars->object_cache_port));
|
||||
}
|
||||
|
||||
if ($vars->object_cache_type === 'redis')
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,6 +180,8 @@ $lang->use_object_cache = 'Use Cache';
|
|||
$lang->cache_default_ttl = 'Cache default TTL';
|
||||
$lang->cache_host = 'Host';
|
||||
$lang->cache_port = 'Port';
|
||||
$lang->cache_user = 'Username';
|
||||
$lang->cache_pass = 'Password';
|
||||
$lang->cache_dbnum = 'DB Number';
|
||||
$lang->cache_truncate_method = 'Cache Truncate Method';
|
||||
$lang->cache_truncate_method_delete = 'Delete cache folder itself';
|
||||
|
|
|
|||
|
|
@ -181,6 +181,8 @@ $lang->use_object_cache = '캐시 사용';
|
|||
$lang->cache_default_ttl = '캐시 기본 TTL';
|
||||
$lang->cache_host = '호스트';
|
||||
$lang->cache_port = '포트';
|
||||
$lang->cache_user = '아이디';
|
||||
$lang->cache_pass = '암호';
|
||||
$lang->cache_dbnum = 'DB번호';
|
||||
$lang->cache_truncate_method = '캐시 비우기 방법';
|
||||
$lang->cache_truncate_method_delete = '캐시 폴더를 삭제';
|
||||
|
|
|
|||
|
|
@ -155,6 +155,10 @@
|
|||
<div id="object_cache_additional_config" class="x_inline" style="display:none;margin-left:16px">
|
||||
<label for="object_cache_host" class="x_inline">{$lang->cache_host}: <input type="text" name="object_cache_host" id="object_cache_host" value="{$object_cache_host}" /></label>
|
||||
<label for="object_cache_port" class="x_inline">{$lang->cache_port}: <input type="number" name="object_cache_port" id="object_cache_port" size="5" style="min-width:70px" value="{$object_cache_port}" /></label>
|
||||
</div>
|
||||
<div id="object_cache_redis_config" style="display:none">
|
||||
<label for="object_cache_user" class="x_inline">{$lang->cache_user}: <input type="text" name="object_cache_user" id="object_cache_user" value="{$object_cache_user}" /></label>
|
||||
<label for="object_cache_pass" class="x_inline">{$lang->cache_pass}: <input type="password" name="object_cache_pass" id="object_cache_pass" value="{$object_cache_pass}" /></label>
|
||||
<label for="object_cache_dbnum" class="x_inline">{$lang->cache_dbnum}: <input type="number" name="object_cache_dbnum" id="object_cache_dbnum" size="3" style="min-width:70px" value="{$object_cache_dbnum}" /></label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,16 +16,17 @@ jQuery(function($){
|
|||
if ($("#object_cache_port").val() == '6379') {
|
||||
$("#object_cache_port").val('11211');
|
||||
}
|
||||
$("#object_cache_dbnum").parents("label").hide();
|
||||
$("#object_cache_redis_config").hide();
|
||||
}
|
||||
if ($(this).val().match(/redis/)) {
|
||||
if ($("#object_cache_port").val() == '11211') {
|
||||
$("#object_cache_port").val('6379');
|
||||
}
|
||||
$("#object_cache_dbnum").parents("label").show();
|
||||
$("#object_cache_redis_config").show();
|
||||
}
|
||||
} else {
|
||||
$("#object_cache_additional_config").hide();
|
||||
$("#object_cache_redis_config").hide();
|
||||
}
|
||||
}).triggerHandler("change");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue