mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 06:20:46 +02:00
[ticket/10110] Enable the serialization and add a constant for
defined the database PHPBB3-10110
This commit is contained in:
@@ -243,6 +243,7 @@ PHPBB_ACM_MEMCACHE_HOST (overwrite memcached host name, default is localhost
|
||||
PHPBB_ACM_REDIS_HOST (overwrite redis host name, default is localhost)
|
||||
PHPBB_ACM_REDIS_PORT (overwrite redis port, default is 6379)
|
||||
PHPBB_ACM_REDIS_PASSWORD (overwrite redis password, default is empty)
|
||||
PHPBB_ACM_REDIS_DB (overwrite redis default database)
|
||||
|
||||
PHPBB_QA (Set board to QA-Mode, which means the updater also checks for RC-releases)
|
||||
</pre></div>
|
||||
|
@@ -56,15 +56,10 @@ class acm extends acm_memory
|
||||
// Call the parent constructor
|
||||
parent::acm_memory();
|
||||
|
||||
if (!extension_loaded('redis'))
|
||||
{
|
||||
trigger_error("Could not find required extension [{$this->extension}] for the ACM module $acm_type.", E_USER_ERROR);
|
||||
}
|
||||
|
||||
$this->redis = new Redis();
|
||||
foreach (explode(',', PHPBB_ACM_REDIS) as $u)
|
||||
foreach (explode(',', PHPBB_ACM_REDIS) as $server)
|
||||
{
|
||||
$parts = explode('/', $u);
|
||||
$parts = explode('/', $server);
|
||||
$this->redis->connect(trim($parts[0]), trim($parts[1]));
|
||||
}
|
||||
|
||||
@@ -72,9 +67,24 @@ class acm extends acm_memory
|
||||
{
|
||||
if (!$this->redis->auth(PHPBB_ACM_REDIS_PASSWORD))
|
||||
{
|
||||
global $acm_type;
|
||||
|
||||
trigger_error("Incorrect password for the ACM module $acm_type.", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
|
||||
$this->redis->setOption(Redis::OPT_PREFIX, $this->key_prefix);
|
||||
|
||||
if (defined('PHPBB_ACM_REDIS_DB'))
|
||||
{
|
||||
if (!$this->redis->select(PHPBB_ACM_REDIS_DB))
|
||||
{
|
||||
global $acm_type;
|
||||
|
||||
trigger_error("Incorrect database for the ACM module $acm_type.", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +120,7 @@ class acm extends acm_memory
|
||||
*/
|
||||
function _read($var)
|
||||
{
|
||||
return $this->redis->get($this->key_prefix . $var);
|
||||
return $this->redis->get($var);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,7 +134,7 @@ class acm extends acm_memory
|
||||
*/
|
||||
function _write($var, $data, $ttl = 2592000)
|
||||
{
|
||||
return $this->redis->setex($this->key_prefix . $var, $ttl, $data);
|
||||
return $this->redis->setex($var, $ttl, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +146,7 @@ class acm extends acm_memory
|
||||
*/
|
||||
function _delete($var)
|
||||
{
|
||||
if ($this->redis->delete($this->key_prefix . $var) > 0)
|
||||
if ($this->redis->delete($var) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user