网页开发

星期一, 25 7月 2022 19:46

最新解决Discuz!X3.4以下版本前台打开卡慢、后台登陆卡死或504错误等问题

Written by 
Rate this item
(0 votes)

只针对Discuz!X3.4以下的版本前台打开卡慢、后台登陆卡死或504错误的问题。

  形成原因:discuz的补丁升级和版本检查验证已经关闭。而x3.4以下仍然在验证和检查导致链接超时,引起后台打不开。解决办法有两个。

解决方法一,升级到x3.4,x3.4版本已经移除了相关代码。

解决方法二,修改代码:
后台修改,文件source/admincp/admincp_main.php,删除以下代码大概37-60
if($_G['uid'] && $_G'member' == 1 && ($_G['setting']['showpatchnotice'] == 1 || !isset($_G'cookie'))) {

    $discuz_patch = new discuz_patch();
    if($_G['setting']['showpatchnotice'] == 1) {
            $notice = $discuz_patch->fetch_patch_notice();
            if($notice['data']) {
                    $shownotice = '<div class="notice"><a href="'.$basescript.'?action=patch" id="notice">'.($notice['fixed'] ? $lang['patch_fix_complete'] : $lang['patch_fix_rigth_now']).'</a></div>';
            }
    }
    if(!isset($_G['cookie']['checkpatch'])) {
            $discuz_patch->check_patch();
    }

}
if($_G['uid'] && $_G'member' == 1 && !$shownotice && $_G'setting') {

    $shownotice = '<div class="notice"><a href="'.$basescript.'?action=upgrade" id="notice">'.$lang['upgrade_right_now'].'</a></div>';

}
if($_G['uid'] && $_G'member' == 1 && !isset($_G'cookie')) {

    $discuz_upgrade = new discuz_upgrade();
    if($discuz_upgrade->check_upgrade()) {
            if(empty($shownotice)) {
                    $shownotice = '<div class="notice"><a href="'.$basescript.'?action=upgrade" id="notice">'.$lang['upgrade_right_now'].'</a></div>';
            }
    }
    dsetcookie('checkupgrade', 1, 7200);

}

前台修改,打开文件sourcemodulemiscmisc_patch.php 将内容替换。

<?php

/**

  • Discuz!2001-2099 Comsenz Inc.
  • This is NOT a freeware, use is subject to license terms
    *
  • $Id: misc_patch.php 33690 2013-08-02 09:07:22Z nemohou $
    */

if(!defined('IN_DISCUZ')) {

exit('Access Denied');

}

if($_GET['action'] == 'checkpatch') {

header('Content-Type: text/javascript');
exit;

} elseif($_GET['action'] == 'patchnotice') {

include template('common/header_ajax');
include template('common/footer_ajax');
exit;

} elseif($_GET['action'] == 'pluginnotice') {

include template('common/header_ajax');
include template('common/footer_ajax');
exit;

} elseif($_GET['action'] == 'ipnotice') {

require_once libfile('function/misc');
include template('common/header_ajax');
if($_G['cookie']['lip'] && $_G['cookie']['lip'] != ',' && $_G['uid'] && $_G['setting']['disableipnotice'] != 1) {
    $status = C::t('common_member_status')->fetch($_G['uid']);
    $lip = explode(',', $_G['cookie']['lip']);
    $lastipConvert = convertip($lip[0]);
    $lastipDate = dgmdate($lip[1]);
    $nowipConvert = convertip($status['lastip']);

    $lastipConvert = process_ipnotice($lastipConvert);
    $nowipConvert = process_ipnotice($nowipConvert);

    if($lastipConvert != $nowipConvert && stripos($lastipConvert, $nowipConvert) == false && stripos($nowipConvert, $lastipConvert) == false) {
        $lang = lang('forum/misc');
        include template('common/ipnotice');
    }
}
include template('common/footer_ajax');
exit;

}
?>

修改方法就这些,大家可以测试一下。

Read 42 times