問題:超出24小時以內發信息的數量,不能發信息。php
方法:在ucenter的基本設置裏改。能夠更改了更新緩存,前臺沒效果,可是數據庫已經改了。sql
原來他更新緩存沒有更新到那個緩存,我直接到data下面的cache下面把settings.php改過來或者刪除再更新緩存就能夠成功了。只是ucenter和discuz結合以後出現的緩存問題,可是直接ucenter是不用這樣子,settings.php也自動是最新的。數據庫
如下是一些資料:緩存
實際上不少人遇到這個問題 但很快就能解決 由於這個設置是在 ucenter 基本設置中 設置的 只須要將 25設置成0 或者設置成你想要的數量便可。可有的時候遇到 權限混亂的 服務器 真心就尷尬了服務器
若是出現了 已經將24小時 發送限制取消了 仍是沒法正常發送 請查看
uc_client/data/cache/settings.php 文件app
總體上來講 這個的排查很漫長 這裏提供下 總體的 實現邏輯,轉自disucz開發人員 專貼:ide
1、在ucenter中進行短消息的相關設置,每一項設置都會對應一個變量,
發短消息最少註冊天數(pmsendregdays )
同一用戶在24小時內容許發起兩人會話的最大數(privatepmthreadlimit )
同一用戶在24小時內容許發起羣聊會話的最大數(chatpmthreadlimit )
參與同一羣聊會話的最大用戶數(chatpmmemberlimit )
發短消息灌水預防(pmfloodctrl )
啓用短消息中心(pmcenter )
開啓發送短消息驗證碼(sendpmseccode )函數
在uc_server\control\admin\setting.php文件的onls函數中,經過fetch
1 | $this->set_setting('privatepmthreadlimit',intval($privatepmthreadlimit)); |
將設置值更新到數據庫中ui
1
2
3
4
|
functionset_setting($k,$v,$encode= FALSE) {
$v=is_array($v) ||$encode?addslashes(serialize($v)) :$v;
$this->db->query("REPLACE INTO ".UC_DBTABLEPRE."settings SET k='$k', v='$v'");
}
|
可見,這些設置提交後,只會保存到ucenter的設置表settings中,還不會影響論壇的操做。
2、當論壇更新緩存時,程序會按照順序執行各個函數,
1 | updatecache(function_cache.php) -> build_cache_setting(cache_setting.php)-> uc_app_ls(client.php)-> init_cache(base.php)-> cache(base.php)-> updatedata(cache.php)-> _get_settings(cache.php)-> get_setting(base.php) |
在get_setting函數中取出設置的參數值,
1 | $settings=$this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."settings $sqladd"); |
在updatedata函數中寫入到uc_client/data/cache/settings.php文件中。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
functionupdatedata($cachefile='') {
if($cachefile) {
foreach((array)$this->map[$cachefile]as$modules) {
$s="<?php\r\n";
foreach((array)$modulesas$m) {
$method="_get_$m";
$s.='$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
}
$s.="\r\n?>";
@file_put_contents(UC_DATADIR."./cache/$cachefile.php",$s);
}
}else{
foreach((array)$this->mapas$file=>$modules) {
$s="<?php\r\n";
foreach($modulesas$m) {
$method="_get_$m";
$s.='$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
}
$s.="\r\n?>";
@file_put_contents(UC_DATADIR."./cache/$file.php",$s);
}
}
}
|
3、當會員發送短消息的時候,在uc_client\control\pm.php文件的 onsendpm 函數中,所使用的$this->settings['pmsendregdays'] 等,就是uc_client/data/cache/settings.php文件中的值。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
if($this->settings['pmsendregdays']) {
if($user['regdate'] >$this->time -$this->settings['pmsendregdays'] * 86400) {
returnPMSENDREGDAYS;
}
}
if($this->settings['chatpmmemberlimit']) {
if($type== 1 && ($countmsgto> ($this->settings['chatpmmemberlimit'] - 1))) {
returnCHATPMMEMBERLIMIT_ERROR;
}
}
if($this->settings['pmfloodctrl']) {
if(!$_ENV['pm']->ispminterval($this->user['uid'],$this->settings['pmfloodctrl'])) {
returnPMFLOODCTRL_ERROR;
}
}
if($this->settings['privatepmthreadlimit']) {
if(!$_ENV['pm']->isprivatepmthreadlimit($this->user['uid'],$this->settings['privatepmthreadlimit'])) {
returnPRIVATEPMTHREADLIMIT_ERROR;
}
}
if($this->settings['chatpmthreadlimit']) {
if(!$_ENV['pm']->ischatpmthreadlimit($this->user['uid'],$this->settings['chatpmthreadlimit'])) {
returnCHATPMTHREADLIMIT_ERROR;
}
}
|
這就是ucenter中進行短消息設置時,影響前臺短消息發送的過程。有種常見的問題是,其餘操做都沒有問題,就是uc_client\data\cache目錄權限不對,形成設置的緩存不能更新,致使會員發送短消息時出現各類問題。