%
Server.ScriptTimeout = 25000
Dim forumID:forumID = request.form("forumID")
Dim lastUpdate:lastUpdate = request.form("lastUpdate")
Dim totalReply:totalReply = request.form("totalReply")
Dim hits:hits = request.form("hits")
Dim mode:mode = request.form("mode")
Dim hasSearch:hasSearch = false
Dim objRS, objCon , strSQL1, strSQL2, strSQL3, strSQL4, strSQL5
Dim oriTableWidth:oriTableWidth = "550"
Dim percentage:percentage = 0
Dim deleteOrLockStatus:deleteOrLockStatus = ""
Dim mode2percent:mode2percent = 0
if mode = "1" then 'delete
strSQL1 = "DELETE pgd_messages "
deleteOrLockStatus = "Deleting Messages....."
else
strSQL1 = "Update pgd_messages SET Locked = 1 "
deleteOrLockStatus = "Locking Messages....."
mode2percent = 55
end if
strSQL1 = strSQL1 & " WHERE threadID in ( SELECT threadID from pgd_messages WHERE parent = 0 and forumID = "&forumId&" "
if lastUpdate <> "" then
strSQL1 = strSQL1 & "AND lastupdate < DateADD (dd, "&lastUpdate&", GetDate())"
hasSearch = true
end if
if totalReply <> "" then
strSQL1 = strSQL1 & "AND totalreply < "&totalReply&" "
hasSearch = true
end if
if hits <>"" then
strSQL1 = strSQL1 & "AND hits < "&hits&" "
hasSearch = true
end if
if mode <> "1" then
strSQL1 = strSQL1 & "AND Locked = 0"
end if
strSQL1 = strSQL1 & ")"
strSQL2 = "Update pgd_upfile SET pgd_upfile.messageID = -1 "&_
"FROM pgd_upfile LEFT JOIN pgd_messages ON pgd_messages.messageID = pgd_upfile.messageID "&_
"WHERE pgd_messages.messageID is NULL"
if not hasSearch then
response.redirect ("admin_m_delete.asp?done=no")
response.end
end if
'response.write(strSQL1)
'response.end
%>
Mass Message Pruning
<%= OutputCSS() %>
Mass Message Pruning / Locking:
This is a long running process. Please be patient.
| Initializing process... Please wait. |
<%
response.flush
call outputProcess(5,"Shutting down the forum.....")
Call DoThis("spTurnOnOff (1)")
Application.lock
Application(dbName&"boarddown") = 1
Application.unlock
call outputProcess(35+mode2percent,deleteOrLockStatus)
SET objCon = server.createObject("ADODB.connection")
with objCon
.open datastore
.execute strSQL1, , adExecuteNoRecords + adCmdtext
.close
end with
Set objCon = nothing
if mode = "1" then
call outputProcess(7,"Recounting forum topics and posts.....")
Call DoThis("spRecountAllForums")
call updateForum
call outputProcess(7,"Recounting user total posts.....")
Call DoThis("spUpdatePostCount")
call outputProcess(7,"Cleaning up subscription table.....")
Call DoThis("spSubCleanUp")
call outputProcess(20,"Defragment Index.....")
Call DoThis("spdefragfastsort")
call outputProcess(14,"Deleting orphan attachments.....")
SET objCon = server.createObject("ADODB.connection")
with objCon
.open datastore
.execute strSQL2, , adExecuteNoRecords + adCmdtext
.close
end with
Set objCon = nothing
Call DoThis("spCleanAttachment")
end if
call outputProcess(4,"Turning on the forum.....")
Call DoThis("spTurnOnOff (0)")
Application.lock
Application(dbName&"boarddown") = 0
Application.unlock
Call finishedProcess()
%>