| 有鉴于Discuz!X2还有很多朋友在用,但是这个版本不支持wincache(win2003和win2008),系统就算是启用了,Discuz!也起不到完整加速的作用,所以才写了以下教程: 修改的文件有3个(source/admincp/admincp_setting.php,source/class/class_core.php,config/config_global.php),新加的文件1个(source/class/class_wincache.php)
 
 1.source/admincp/admincp_setting.php
 上面添加复制代码        $ea = array('eAccelerator',
            $discuz->mem->extension['eaccelerator'] ? cplang('setting_memory_php_enable') : cplang('setting_memory_php_disable'),
            $discuz->mem->config['eaccelerator'] ? cplang('open') : cplang('closed'),
            $discuz->mem->type == 'eaccelerator' ? $do_clear_link : '--'
            );
-------------------------------------------------------------------复制代码        $wincache = array('WinCache',
            $discuz->mem->extension['wincache'] ? cplang('setting_memory_php_enable') : cplang('setting_memory_php_disable'),
            $discuz->mem->config['wincache'] ? cplang('open') : cplang('closed'),
            $discuz->mem->type == 'wincache' ? $do_clear_link : '--'
            );
上面添加复制代码showtablerow('', '', $ea);
2.source/class/class_core.php复制代码showtablerow('', '', $wincache);
上面添加复制代码$this->extension['eaccelerator'] = function_exists('eaccelerator_get');
--------------------------------------------------------------------复制代码$this->extension['wincache'] = function_exists('wincache_ucache_get');
上面添加复制代码        if(!is_object($this->memory) && $this->extension['eaccelerator'] && $this->config['eaccelerator']) {
            require_once libfile('class/eaccelerator');
            $this->memory = new discuz_eaccelerator();
            $this->memory->init(null);
        }
3.新加文件source/class/class_wincache.php复制代码
        if(!is_object($this->memory) && $this->extension['wincache'] && $this->config['wincache']) {
            require_once libfile('class/wincache');
            $this->memory = new discuz_wincache();
            $this->memory->init(null);
        }
4.修改配置文件config/config_global.php复制代码
<?php
/**
 *      wincache for Discuz X1.5 By SquallATF
 */
class discuz_wincache
{
    function discuz_wincache() {
    }
    function init($config) {
    }
    function get($key) {
        return wincache_ucache_get($key);
    }
    function set($key, $value, $ttl = 0) {
        return wincache_ucache_set($key, $value, $ttl);
    }
    function rm($key) {
        return wincache_ucache_delete($key);
    }
}
?>
添加
 适用于windows下iis/apache使用wincache的情况复制代码$_config['memory']['wincache'] = 1;
 本插件有无限星辰工作室www.xmspace.net整理发布,转载请注明地址,谢谢!
 |