找回密码
 立即注册

QQ登录

只需一步,快速开始

让 Discuz!X2 完整支持WinCache

有鉴于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
  1.         $ea = array('eAccelerator',
  2.             $discuz->mem->extension['eaccelerator'] ? cplang('setting_memory_php_enable') : cplang('setting_memory_php_disable'),
  3.             $discuz->mem->config['eaccelerator'] ? cplang('open') : cplang('closed'),
  4.             $discuz->mem->type == 'eaccelerator' ? $do_clear_link : '--'
  5.             );
复制代码
上面添加
  1.         $wincache = array('WinCache',
  2.             $discuz->mem->extension['wincache'] ? cplang('setting_memory_php_enable') : cplang('setting_memory_php_disable'),
  3.             $discuz->mem->config['wincache'] ? cplang('open') : cplang('closed'),
  4.             $discuz->mem->type == 'wincache' ? $do_clear_link : '--'
  5.             );
复制代码
-------------------------------------------------------------------
  1. showtablerow('', '', $ea);
复制代码
上面添加
  1. showtablerow('', '', $wincache);
复制代码
2.source/class/class_core.php
  1. $this->extension['eaccelerator'] = function_exists('eaccelerator_get');
复制代码
上面添加
  1. $this->extension['wincache'] = function_exists('wincache_ucache_get');
复制代码
--------------------------------------------------------------------
  1.         if(!is_object($this->memory) && $this->extension['eaccelerator'] && $this->config['eaccelerator']) {
  2.             require_once libfile('class/eaccelerator');
  3.             $this->memory = new discuz_eaccelerator();
  4.             $this->memory->init(null);
  5.         }
复制代码
上面添加

  1.         if(!is_object($this->memory) && $this->extension['wincache'] && $this->config['wincache']) {
  2.             require_once libfile('class/wincache');
  3.             $this->memory = new discuz_wincache();
  4.             $this->memory->init(null);
  5.         }
复制代码
3.新加文件source/class/class_wincache.php

  1. <?php

  2. /**
  3. *      wincache for Discuz X1.5 By SquallATF
  4. */

  5. class discuz_wincache
  6. {

  7.     function discuz_wincache() {

  8.     }

  9.     function init($config) {

  10.     }

  11.     function get($key) {
  12.         return wincache_ucache_get($key);
  13.     }

  14.     function set($key, $value, $ttl = 0) {
  15.         return wincache_ucache_set($key, $value, $ttl);
  16.     }

  17.     function rm($key) {
  18.         return wincache_ucache_delete($key);
  19.     }

  20. }

  21. ?>
复制代码
4.修改配置文件config/config_global.php
添加
  1. $_config['memory']['wincache'] = 1;
复制代码
适用于windows下iis/apache使用wincache的情况

插件无限星辰工作室www.xmspace.net整理发布,转载请注明地址,谢谢!

本教程由无限星辰工作室CRX349独家整理和提供,转载请注明地址,谢谢。本文地址:https://www.xmspace.net/thread-76-1-1.html
无限星辰工作室  好集导航 Discuz全集下载  星辰站长网  集热爱361  一品文学  手机小游戏合集   海外空间网 星辰api  星辰支付二维码管理平台 阿里云服务器 腾讯云服务器
服务Discuz!建站|DiscuzQ配置|二开|小程序|APP|搬家|挂马清理|防护|Win/Linux环境搭建|优化|运维|
服务理念:专业 诚信 友好QQ842062626 服务项目 Q群315524225

发表于 2013-8-10 12:38:27 | 显示全部楼层 |阅读模式

回复 | 使用道具 举报

该帖共收到 0 条回复!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

美图秀

    • fastadmin 后台界面使用字段数组类型
    • Discuz!x3.5 修改标题高亮颜色
    • Discuz!x3.5 应用中心 下载应用一直下载中
    • 帖子定时显示
    • 论坛辅助审核
拖动客服框
Online Service
点击这里给我发消息
点击这里联系我们
微信扫一扫
在线客服
快速回复 返回顶部 返回列表