如图
打开 control/c_general.asp 找到
<input type="checkbox" name="ReBulidIndex" value="1" id="T4"/> <label for="T4">重新建立日志列表翻页索引<span style="color:#666">(可以修复日志列表翻页错误的问题)</span></label>
下面添加
<b>4.指定日志缓存和静态日志重建</b><span style="color:#f00">(这个过程可能会花很长时间,由你设定的日志数量来决定)</span>
起始ID:<input name="Start_Log_id" type="text" size="5" class="text"/> 更新到ID:<input name="End_Log_id" type="text" size="5" class="text"/>
打开 control/Action.asp 找到
If Request.Form("ReBulidArticle") = 1 or Request.Form("ReBulidArticle") = 2 Then
到
session(CookieName&"_MsgText") = Session(CookieName&"_MsgText")&"共处理了 "&LogLen&" 篇日志文件! "
之间全部换成
If Request.Form("ReBulidArticle") = 1 or Request.Form("ReBulidArticle") = 2 Then
Dim LogLen, LoadArticle, silent, Start_Log_id, End_Log_id, Logid
Start_Log_id = Request.Form("Start_Log_id")
End_Log_id = Request.Form("End_Log_id")
silent = Request.Form("silentMode")
If Start_Log_id = "" or Start_Log_id > End_Log_id then Start_Log_id = 1
If End_Log_id = "" or End_Log_id < Start_Log_id then End_Log_id = conn.Execute("Select count(log_ID) FROM blog_Content")(0).Value
For Logid = Start_Log_id to End_Log_id
Set LoadArticle = conn.Execute("Select * FROM blog_Content where log_id="&Logid)
If not (LoadArticle.bof or LoadArticle.eof) then LogLen = LogLen + 1
Next
If silent <> 1 Then
%>
<h5 style="margin-bottom:4px;">正在静态化相关的日志缓存... 共<%=LogLen%>篇日志需要处理. <span style="color:#f00">静态化过程,请不要关闭您的浏览器</span></h5>
<div style="background:#fff;padding:1px;border:1px solid #333">
<div id="per" style="width:0%;background:#0000a0 url(images/per.png);overflow:hidden;color:#fff;font-weight:bold;padding:2px;font-family:verdana;font-size:12px;white-space:nowrap">0%</div>
</div>
<script>
var _t = <%=LogLen%>;
var _p = document.getElementById("per");
var _cc = document.getElementById("cc");
var d = new Date();
function _s(c) {
var p = parseInt((c/_t)*100);
var d1 = new Date();
_p.style.width = p + "%";
_p.innerHTML = c + " of " + _t + " : " + p + "%" + " : " + ((d1 -d)/1000) + "s";
//_cc.innerHTML = c;
}
</script>
<%
End If
Application.Lock
Application(CookieName & "_SiteEnable") = 0
Application(CookieName & "_SiteDisbleWhy") = "抱歉!网站在初始化数据,请稍后在访问. :P"
Application.UnLock
Dim iLen
For Logid = Start_Log_id to End_Log_id
Set LoadArticle = conn.Execute("Select * FROM blog_Content where log_id="&Logid)
If not (LoadArticle.bof or LoadArticle.eof) then
If Request.Form("ReBulidArticle") = 2 Then
PostArticle Logid, True
Else
PostArticle Logid, False
End If
If silent <> 1 Then
iLen = iLen + 1
Response.Write ("<script>_s(" & iLen & ");</script>")
Response.Flush()
End If
End If
Next
Application.Lock
Application(CookieName & "_SiteEnable") = 1
Application(CookieName & "_SiteDisbleWhy") = ""
Application.UnLock
session(CookieName&"_ShowMsg") = True
session(CookieName&"_MsgText") = Session(CookieName&"_MsgText")&"共处理了 "&LogLen&" 篇日志文件! "
方法感觉不是挺好,因为读取了2次数据库,第一次计算处理的日志数量