有鉴于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);
复制代码 上面添加- showtablerow('', '', $wincache);
复制代码 2.source/class/class_core.php- $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);
- }
复制代码 上面添加
- 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);
- }
复制代码 3.新加文件source/class/class_wincache.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);
- }
- }
- ?>
复制代码 4.修改配置文件config/config_global.php
添加- $_config['memory']['wincache'] = 1;
复制代码 适用于windows下iis/apache使用wincache的情况
本插件有无限星辰工作室www.xmspace.net整理发布,转载请注明地址,谢谢! |