mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Fix some issues with XCache, can't totally resolve the purge() method as XCache does not expose its settings to userland PHP. #46435
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9579 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
290893c3a7
commit
75ae7aee97
2 changed files with 22 additions and 4 deletions
|
@ -39,7 +39,7 @@ class acm_memory
|
||||||
global $phpbb_root_path, $dbname, $table_prefix;
|
global $phpbb_root_path, $dbname, $table_prefix;
|
||||||
|
|
||||||
$this->cache_dir = $phpbb_root_path . 'cache/';
|
$this->cache_dir = $phpbb_root_path . 'cache/';
|
||||||
$this->key_prefix = md5($dbname, $table_prefix) . '_';
|
$this->key_prefix = substr(md5($dbname . $table_prefix), 0, 8) . '_';
|
||||||
|
|
||||||
if (!isset($this->extension) || !extension_loaded($this->extension))
|
if (!isset($this->extension) || !extension_loaded($this->extension))
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,10 +25,25 @@ if (!class_exists('acm_memory'))
|
||||||
/**
|
/**
|
||||||
* ACM for XCache
|
* ACM for XCache
|
||||||
* @package acm
|
* @package acm
|
||||||
|
*
|
||||||
|
* To use this module you need ini_get() enabled and the following INI settings configured as follows:
|
||||||
|
* - xcache.var_size > 0
|
||||||
|
* - xcache.admin.enable_auth = off (or xcache.admin.user and xcache.admin.password set)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class acm extends acm_memory
|
class acm extends acm_memory
|
||||||
{
|
{
|
||||||
var $extension = 'xcache';
|
var $extension = 'XCache';
|
||||||
|
|
||||||
|
function acm()
|
||||||
|
{
|
||||||
|
parent::acm_memory();
|
||||||
|
|
||||||
|
if (!function_exists('ini_get') || (int) ini_get('xcache.var_size') <= 0)
|
||||||
|
{
|
||||||
|
trigger_error('Increase xcache.var_size setting above 0 or enable ini_get() to use this ACM module.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge cache data
|
* Purge cache data
|
||||||
|
@ -37,14 +52,17 @@ class acm extends acm_memory
|
||||||
*/
|
*/
|
||||||
function purge()
|
function purge()
|
||||||
{
|
{
|
||||||
|
// Run before for XCache, if admin functions are disabled it will terminate execution
|
||||||
|
parent::purge();
|
||||||
|
|
||||||
|
// If the admin authentication is enabled but not set up, this will cause a nasty error.
|
||||||
|
// Not much we can do about it though.
|
||||||
$n = xcache_count(XC_TYPE_VAR);
|
$n = xcache_count(XC_TYPE_VAR);
|
||||||
|
|
||||||
for ($i = 0; $i < $n; $i++)
|
for ($i = 0; $i < $n; $i++)
|
||||||
{
|
{
|
||||||
xcache_clear_cache(XC_TYPE_VAR, $i);
|
xcache_clear_cache(XC_TYPE_VAR, $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::purge();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue