解决discuz表崩溃 is marked as crashed之类问题

discuz教程
此类问题 is marked as crashed and last (automatic?) repair failedDELETE FROM security_failedlog WHERE pid = 0 AND tid = 0 AND uid = 0 OR lastfailtime = 0 OR failcount >= 10,真是头疼,天天要进后台去点击修复,甚至一天要好几次,研究了好久终于解决了,方法很简单,一劳永逸,打开discuz_table.php,在这里加入自动检查修复的一段代码就ok了,操作如下:

。。。。。。。。。。。。。。。。。。。。。。。。

public function __construct($para = array()) { if(!empty($para)) { $this->_table = $para['table']; $this->_pk = $para['pk']; } if(isset($this->_pre_cache_key) && (($ttl = getglobal('setting/memory/'.$this->_table)) !== null || ($ttl = $this->_cache_ttl) !== null) && memory('check')) { $this->_cache_ttl = $ttl; $this->_allowmem = true; } $this->repair();//解决表是否崩溃,新加进去的代码 $this->_init_extend(); parent::__construct(); } //解决表是否崩溃,新加进去的一个自己检查是否需要修复的代码 public function repair() { $query1=DB::query('CHECK TABLE '.DB::table($this->_table)); $checkresult =mysql_fetch_array($query1, MYSQL_ASSOC); //echo(DB::table($this->_table)); //exit; if($checkresult['Msg_text'] != 'OK') { DB::query('REPAIR TABLE '.DB::table($this->_table)); } }

标签: