mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
Allow connection to Memcached and Redis via unix socket
This commit is contained in:
parent
363f2feeac
commit
1042479d5b
4 changed files with 93 additions and 34 deletions
|
|
@ -519,10 +519,19 @@ class adminAdminView extends admin
|
|||
|
||||
if ($cache_servers)
|
||||
{
|
||||
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);
|
||||
$cache_dbnum = preg_replace('/[^\d]/', '', parse_url(array_first($cache_servers), PHP_URL_PATH));
|
||||
Context::set('object_cache_dbnum', $cache_dbnum === '' ? 1 : intval($cache_dbnum));
|
||||
if (preg_match('!^(/.+)(#[0-9]+)?$!', array_first($cache_servers), $matches))
|
||||
{
|
||||
Context::set('object_cache_host', $matches[1]);
|
||||
Context::set('object_cache_port', 0);
|
||||
Context::set('object_cache_dbnum', $matches[2] ? substr($matches[2], 1) : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
$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));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue