Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Unarchive Mod?
 New Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

clatters
Starting Member

United Kingdom
11 Posts

Posted - 11 August 2015 :  15:36:11  Show Profile  Visit clatters's Homepage  Reply with Quote
A long, long time ago I archived a large section of my forum, which I subsequently regretted.

I've been searching here on the forum for a mod and thought I'd found one, but when I download it, it appears to be an invalid .zip file.

(http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=41670)

Does anyone still have this mod? or can tell me where to get it.

Thanks

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 12 August 2015 :  05:57:40  Show Profile  Visit HuwR's Homepage
I'm afraid not, plus I am not sure whether the mod was fully finished as there are some issues with unarchiving that make it difficult to accomplish (any links to archived topics/replies would be broken if the topic was unarchived.

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 12 August 2015 :  06:12:08  Show Profile  Visit HuwR's Homepage
If you look at this post http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=33703&SearchTerms=un-archive
There is a post by work_mule which contains a sql script for unarchiving a topic/replies it only does one topic at a time, and does not preserve the topic_id, however it could be modified to allow preservation if you are using SQL SERVER, you could set ENTITY INSERT ON before running and then turn it off again afterwards, obviously you would need to adjust the script acccordingly

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 12 August 2015 :  06:32:38  Show Profile  Visit HuwR's Homepage
If you are using SQL server, the following script can be used to un-archive topics while preserving there ID's


SET IDENTITY_INSERT FORUM_TOPICS ON
GO

INSERT INTO [FORUM_TOPICS]
           ([CAT_ID]
           ,[FORUM_ID]
		   ,[TOPIC_ID]
           ,[T_STATUS]
           ,[T_MAIL]
           ,[T_SUBJECT]
           ,[T_MESSAGE]
           ,[T_AUTHOR]
           ,[T_REPLIES]
           ,[T_VIEW_COUNT]
           ,[T_LAST_POST]
           ,[T_DATE]
           ,[T_LAST_POSTER]
           ,[T_IP]
           ,[T_ARCHIVE_FLAG]
           ,[T_LAST_POST_AUTHOR]
           ,[T_STICKY]
           ,[T_LAST_EDIT]
           ,[T_LAST_EDITBY]
           ,[T_SIG]
           ,[T_LAST_POST_REPLY_ID]
           ,[T_UREPLIES])
		SELECT [CAT_ID]
			  ,[FORUM_ID]
			  ,[TOPIC_ID]
			  ,[T_STATUS]
			  ,[T_MAIL]
			  ,[T_SUBJECT]
			  ,[T_MESSAGE]
			  ,[T_AUTHOR]
			  ,[T_REPLIES]
			  ,[T_VIEW_COUNT]
			  ,[T_LAST_POST]
			  ,[T_DATE]
			  ,[T_LAST_POSTER]
			  ,[T_IP]
			  ,0
			  ,[T_LAST_POST_AUTHOR]
			  ,[T_STICKY]
			  ,[T_LAST_EDIT]
			  ,[T_LAST_EDITBY]
			  ,[T_SIG]
			  ,[T_LAST_POST_REPLY_ID]
			  ,[T_UREPLIES]
		  FROM [FORUM_A_TOPICS]
		  WHERE [TOPIC_ID] IN (comma separated list of topic_id)
GO
SET IDENTITY_INSERT FORUM_TOPICS OFF
GO
SET IDENTITY_INSERT FORUM_REPLY ON
GO
INSERT INTO [FORUM_REPLY]
           ([CAT_ID]
           ,[FORUM_ID]
           ,[TOPIC_ID]
           ,[REPLY_ID]
           ,[R_MAIL]
           ,[R_AUTHOR]
           ,[R_MESSAGE]
           ,[R_DATE]
           ,[R_IP]
           ,[R_STATUS]
           ,[R_LAST_EDIT]
           ,[R_LAST_EDITBY]
           ,[R_SIG])
SELECT [CAT_ID]
      ,[FORUM_ID]
      ,[TOPIC_ID]
      ,[REPLY_ID]
      ,[R_MAIL]
      ,[R_AUTHOR]
      ,[R_MESSAGE]
      ,[R_DATE]
      ,[R_IP]
      ,[R_STATUS]
      ,[R_LAST_EDIT]
      ,[R_LAST_EDITBY]
      ,[R_SIG]
  FROM [FORUM_A_REPLY]
  WHERE [TOPIC_ID] IN (comma separated list of topic_id)
GO
SET IDENTITY_INSERT FORUM_REPLY OFF
GO

DELETE FROM FORUM_A_REPLY WHERE TOPIC_ID IN (comma separated list of topic_id)
GO
DELETE FROM FORUM_A_TOPICS WHERE TOPIC_ID IN (comma separated list of topic_id)
GO


This will unarchive by topic, but could easily be changed to do an entire forum of topics by simply adjusting the where clauses

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 12 August 2015 :  17:27:24  Show Profile
Here you go. I didn't have it, but took the examples and made you one. Note the areas in red. If you don't have the mods installed which use those fields, delete the red sections.

"admin_unarchive.asp"


<%
'#################################################################################
'## Snitz Forums 2000 v3.4.07
'#################################################################################
'## Copyright (C) 2000-15 Michael Anderson, Pierre Gorissen,
'##                       Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain
'## intact in the scripts and in the HTML output.  The "powered by"
'## text/logo with a link back to http://forum.snitz.com in the
'## footer of the pages MUST remain visible when the pages are
'## viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to Free Software Foundation, Inc.
'## 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
'##
'## Support can be obtained from our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp" -->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
If Session(strCookieURL & "Approval") <> "15916941253" Then
	scriptname = split(Request.ServerVariables("SCRIPT_NAME"),"/")
	Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname)) & "?" & Request.ServerVariables("Query_String")
End If
On Error Resume Next
Response.Write	"<center><table border=""0"" width=""100%"">" & vbNewLine & _
	"	<tr>" & vbNewLine & _
	"		<td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
	"   	" & getCurrentIcon(strIconFolder,"","align=""absmiddle""") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
	"		" & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
	"		" & getCurrentIcon(strIconBlank,"","align=""absmiddle""") & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""") & " Unarchive Topics<br /></font></td>" & vbNewLine & _
	"	</tr>" & vbNewLine & _
	"</table>" & vbNewLine & _
	"<br />" & vbNewLine
Dim strTopicList
If Request("whichpage") > "" Then
	mypage = Trim(chkString(Request("whichpage"),"SQLString"))
End If
If ((mypage = "") Or (IsNumeric(mypage) = FALSE)) Then mypage = 1
mypage = CLng(mypage)
If Request("Submit") >"" Then
	strTopicList=chkString(Trim(Request("Unarchive")),"SQLString")+","
	strTopicList=Left(strTopicList, Len(strTopicList)-1)
	If strActivePrefix = "" Then strActivePrefix = strTablePrefix
	If strArchiveTablePrefix = "" Then strArchiveTablePrefix = strActivePrefix & "_A_"
	If strDBType = "sqlserver" Then my_Conn.Execute("Set Identity_Insert " & strActivePrefix & "TOPICS ON")
	strSQL = "INSERT INTO " & strActivePrefix & "TOPICS " &_
	"(" &_
	"  CAT_ID" &_
	", ALLOW_RATING" &_
	", FORUM_ID" &_
	", T_ARCHIVE_FLAG" &_
	", T_AUTHOR" &_
	", T_CHKSUM" &_
	", T_DATE" &_
	", T_IP" &_
	", T_ISPOLL" & _
	", T_LAST_EDIT" &_
	", T_LAST_EDITBY" &_
	", T_LAST_POST" &_
	", T_LAST_POST_AUTHOR" &_
	", T_LAST_POST_REPLY_ID" &_
	", T_LAST_POSTER" &_
	", T_MAIL" &_
	", T_MEMVIEWED" &_
	", T_MESSAGE" &_
	", T_MSGICON" &_
	", T_NOTELET_EDITBY" &_
	", T_NOTELET_LAST_DATE" &_
	", T_NOTELET_MESSAGE" &_
	", T_NOTELET_STATUS" &_
	", T_POLLSTATUS" &_
	", T_POSTS" &_
	", T_REPLIES" &_
	", T_SIG" &_
	", T_STATUS" &_
	", T_STICKY" &_
	", T_SUBJECT" &_
	", T_UREPLIES" &_
	", T_VIEW_COUNT" &_
	", TOPIC_ID" & _
	", TOPIC_RATING_TOTAL" &_
	", TOPIC_RATING_TOTAL_COUNT" &_
	") " &_
	" SELECT" &_
	"  CAT_ID" &_
	", ALLOW_RATING" &_
	", FORUM_ID" &_
	", 0" &_
	", T_AUTHOR" &_
	", T_CHKSUM" &_
	", T_DATE" &_
	", T_IP" &_
	", T_ISPOLL" & _
	", '"  & DateToStr(strForumTimeAdjust) & "'" &_
	", " & MemberID &_
	", T_LAST_POST" &_
	", T_LAST_POST_AUTHOR" &_
	", T_LAST_POST_REPLY_ID" &_
	", T_LAST_POSTER" &_
	", T_MAIL" &_
	", T_MEMVIEWED" &_
	", T_MESSAGE" &_
	", T_MSGICON" &_
	", T_NOTELET_EDITBY" &_
	", T_NOTELET_LAST_DATE" &_
	", T_NOTELET_MESSAGE" &_
	", T_NOTELET_STATUS" &_
	", T_POLLSTATUS" &_
	", T_POSTS" &_
	", T_REPLIES" &_
	", T_SIG" &_
	", T_STATUS" &_
	", T_STICKY" &_
	", T_SUBJECT" &_
	", T_UREPLIES" &_
	", T_VIEW_COUNT" &_
	", TOPIC_ID" & _
	", TOPIC_RATING_TOTAL" &_
	", TOPIC_RATING_TOTAL_COUNT" &_
	" FROM " & strArchiveTablePrefix & "TOPICS" &_
	" WHERE TOPIC_ID IN (" & strTopicList & ")"
	my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
	If strDBType = "sqlserver" Then my_Conn.Execute("Set Identity_Insert " & strActivePrefix & "TOPICS OFF")
	If strDBType = "sqlserver" Then my_Conn.Execute("Set Identity_Insert " & strActivePrefix & "REPLY ON")
	strSQL = "INSERT INTO " & strActivePrefix & "REPLY" &_
	"(" &_
	"  CAT_ID" &_
	", FORUM_ID" &_
	", R_AUTHOR" &_
	", R_CHKSUM" &_
	", R_DATE" &_
	", R_IP" &_
	", R_LAST_EDIT" &_
	", R_LAST_EDITBY" &_
	", R_MAIL" &_
	", R_MESSAGE" &_
	", R_MSGICON" &_
	", R_POSTS" &_
	", R_SIG" &_
	", R_STATUS" &_
	", REPLY_ID" &_
	", TOPIC_ID" &_
	")" &_
	" SELECT" &_
	"  CAT_ID" &_
	", FORUM_ID" &_
	", R_AUTHOR" &_
	", R_CHKSUM" &_
	", R_DATE" &_
	", R_IP" &_
	", R_LAST_EDIT" &_
	", R_LAST_EDITBY" &_
	", R_MAIL" &_
	", R_MESSAGE" &_
	", R_MSGICON" &_
	", R_POSTS" &_
	", R_SIG" &_
	", R_STATUS" &_
	", REPLY_ID" &_
	", TOPIC_ID" &_
	" FROM " & strArchiveTablePrefix & "REPLY" &_
	" WHERE TOPIC_ID IN (" & strTopicList & ")"
	my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
	If strDBType = "sqlserver" Then my_Conn.Execute("Set Identity_Insert " & strActivePrefix & "REPLY OFF")
	strSQL = "DELETE FROM " & strArchiveTablePrefix & "REPLY WHERE TOPIC_ID IN (" & strTopicList & ")"
	my_Conn.Execute(strSql)
	strSQL = "DELETE FROM " & strArchiveTablePrefix & "TOPICS WHERE TOPIC_ID IN (" & strTopicList & ")"
	my_Conn.Execute(strSql)
	Response.Redirect	"admin_count.asp"
	WriteFooter
	Response.End
End If
If Request("sort")	> "" Then
	If Right(Request("sort"),3) = "esc" Then
		strSort = Left(Request("sort"),Len(Request("sort"))-4) & " " & Right(Request("sort"),4)
	Else
		strSort = Left(Request("sort"),Len(Request("sort"))-3) & " " & Right(Request("sort"),3)
	End If
	strSort = " ORDER BY " & strSort
Else
	strSort = " ORDER BY TOPIC_ID ASC"
End If
If Request("cond") > "" Then
	strCond = Request("cond")
Else
	strCond = ""
End If
If Request("where") > "" And strCond > "" Then
	strInput = Request("where")
	strWhere = " WHERE " & strCond & " LIKE '%" & strInput & "%'"
Else
	strWhere = ""
End If
If Request("reset") = "Clear" Then
	strCond = "" : strWhere = "" : strInput = ""
End If
Response.Write	"<form action=""admin_unarchive.asp"" method=""post"">" & vbNewLine & _
	"	<table border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"" width=""100%"">" & vbNewLine & _
	"		<tr>" & vbNewLine & _
	"			<td bgcolor=""" & strTableBorderColor & """>" & vbNewLine & _
	"		  	<table width=""100%"" border=""1"" cellspacing=""0"" cellpadding=""4"">" & vbNewLine & _
	"		    	<tr bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
	"		      	<td align=""center"" colspan=""2""><a name=""top"" />" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Search</b></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"		    	</tr>" & vbNewLine & _
	"		    	<tr bgcolor=""" & strForumCellColor & """ valign=""middle"">" & vbNewLine & _
	"						<td align=""right"" width=""30%"">" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><b>Author</b> <input type=""radio"" class=""radio"" style=""background:" & strForumCellColor & ";"" name=""cond"" value=""T_Author""" & chkRadio(strCond,"T_Author",false) & "> <br/><b>Subject</b> <input type=""radio"" class=""radio"" style=""background:" & strForumCellColor & ";"" name=""cond"" value=""T_Subject""" & chkRadio(strCond,"T_Subject",false) & "> <br /><b>Message</b> <input type=""radio"" class=""radio"" style=""background:" & strForumCellColor & ";"" name=""cond"" value=""T_Message""" & chkRadio(strCond,"T_Message",false) & "> </font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"						<td align=""center"" width=""70%"">" & vbNewLine & _
	"							<input type=""text"" style=""line-height:3; width:99%; color:navy; background-color:lightblue; font-weight:bold; text-align:center;"" name=""where"" value=""" & strInput & """ />" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"					</tr>" & vbNewLine & _
	"				</table>" & vbNewLine & _
	"			</td>" & vbNewLine & _
	"		</tr>" & vbNewLine & _
	"		<tr>" & vbNewLine & _
	"			<td colspan=""2"" align=""center"" style=""line-height:50%;""><br />" & vbNewLine & _
	"				<input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; font-weight:bold; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:"&strHColor&";"" type=""Submit"" class=""button2"" name=""Search"" value=""Search"" />" & vbNewLine & _
	"				<input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; font-weight:bold; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:"&strHColor&";"" type=""Submit"" class=""button2"" name=""reset"" value=""Clear"" />" & vbNewLine & _
	"			</td>" & vbNewLine & _
	"		</tr>" & vbNewLine & _
	"	</table>" & vbNewLine & _
	"</form><br />" & vbNewLine & _
	"<form action=""admin_unarchive.asp"" method=""post"">" & vbNewLine & _
	"	<table border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"" width=""100%"">" & vbNewLine & _
	"		<tr>" & vbNewLine & _
	"			<td bgcolor=""" & strTableBorderColor & """>" & vbNewLine & _
	"		  	<table width=""100%"" border=""1"" cellspacing=""0"" cellpadding=""4"">" & vbNewLine & _
	"		    	<tr bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
	"		      	<td align=""center"" colspan=""7""><a name=""top"" />" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Unarchive Topics</b></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"		    	</tr>" & vbNewLine & _
	"		    	<tr bgcolor = """ & strHeadCellColor & """ vAlign=""top"">" & vbNewLine & _
	"						<td width=""5%"" align=""center"" nowrap>" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><br /><a style=""color:" & strHeadFontColor & ";"" href=""admin_unarchive.asp?where=" & Request("where") & "&cond=" & Request("cond") & "&sort="
If Request.QueryString("sort") = "Topic_IDAsc" Then Response.Write("Topic_IDDesc") Else Response.Write("Topic_IDAsc")
Response.Write	"""" & dWStatus("Sort by Topic_ID") & "><b>Topic ID</b></a></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"						<td width=""15%"" align=""center"">" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><br /><a style=""color:" & strHeadFontColor & ";"" href=""admin_unarchive.asp?where=" & Request("where") & "&cond=" & Request("cond") & "&sort="
If Request.QueryString("sort") = "T_AuthorAsc" Then Response.Write("T_AuthorDesc") Else Response.Write("T_AuthorAsc")
Response.Write	"""" & dWStatus("Sort by Author") & "><b>Author</b></a></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"						<td width=""25%"" align=""center"">" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><br /><a style=""color:" & strHeadFontColor & ";"" href=""admin_unarchive.asp?where=" & Request("where") & "&cond=" & Request("cond") & "&sort="
If Request.QueryString("sort") = "T_SubjectAsc" Then Response.Write("T_SubjectDesc") Else Response.Write("T_SubjectAsc")
Response.Write	"""" & dWStatus("Sort by Subject") & "><b>Subject</b></a></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"						<td width=""35%"" align=""center"">" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><br /><b>Message</b></a></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"						<td width=""10%"" align=""center"">" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><br /><a style=""color:" & strHeadFontColor & ";"" href=""admin_unarchive.asp?where=" & Request("where") & "&cond=" & Request("cond") & "&sort="
If Request.QueryString("sort") = "T_DateAsc" Then Response.Write("T_DateDesc") Else Response.Write("T_DateAsc")
Response.Write	"""" & dWStatus("Sort by Date") & "><b>Date</b></a></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"						<td width=""5%"" align=""center"">" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><br /><a style=""color:" & strHeadFontColor & ";"" href=""admin_unarchive.asp?where=" & Request("where") & "&cond=" & Request("cond") & "&sort="
If Request.QueryString("sort") = "T_IsPollAsc" Then Response.Write("T_IsPollDesc") Else Response.Write("T_IsPollAsc")
Response.Write	"""" & dWStatus("Sort by Poll") & "><b>Poll</b></a></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"						<td width=""5%"" align=""center"">" & vbNewLine & _
	"							<font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><br /><b>Restore</b></font>" & vbNewLine & _
	"						</td>" & vbNewLine & _
	"		    	</tr>" & vbNewLine
intI = 0 : intCounter = 0 : intStart = (MyPage -1) * 25
strSqlAT = "SELECT COUNT(TOPIC_ID) AS CNT FROM " & strArchiveTablePrefix & "TOPICS" & strWhere
Set rsAT = my_Conn.Execute(strSqlAT)
If Not rsAT.EOF Then
	intCnt = rsAT("CNT")
	rsAT.Close
End If
Set rsAT = Nothing
If intCnt > 0 Then
	TotalPages = intCnt/25
	strSqlAT = "SELECT TOPIC_ID, T_AUTHOR, T_SUBJECT, T_MESSAGE, T_DATE, T_ISPOLL FROM " & strArchiveTablePrefix & "TOPICS" & strWhere & strSort
	Set rsAT = my_Conn.Execute(strSqlAT)
	If Not rsAT.EOF Or rsAT.BOF Then
		rsAT.Move(intStart)
		Do While Not rsAT.EOF
			intTopicID = rsAT("Topic_ID")
			strSqlM = "SELECT M_NAME FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID=" & rsAT("T_AUTHOR")
			Set rsM = my_Conn.Execute(strSqlM)
			If Not rsM.EOF Then
				strAuthor = rsM("M_NAME")
			Else
				strAuthor = "Deleted"
			End If
			strSubject = rsAT("T_SUBJECT")
			strMessage = rsAT("T_MESSAGE")
			strDate = StrtoDate(rsAT("T_DATE"))
			strIsPoll = rsAT("T_ISPOLL")
			If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
			If intCounter = 25 Then Exit Do
			If strIsPoll = 1 Then strPoll = "Poll" Else strPoll = ""
			Response.Write	"					<tr bgcolor = """ & CColor & """ vAlign=""top"">" & vbNewLine & _
				"						<td width=""5%"">" & vbNewLine & _
				"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & intTopicID & "</font>" & vbNewLine & _
				"						</td>" & vbNewLine & _
				"						<td width=""15%"">" & vbNewLine & _
				"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & strAuthor & "</font>" & vbNewLine & _
				"						</td>" & vbNewLine & _
				"						<td width=""25%"">" & vbNewLine & _
				"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & strSubject & "</font>" & vbNewLine & _
				"						</td>" & vbNewLine & _
				"						<td width=""35%"">" & vbNewLine & _
				"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><textarea style=""width:100%;"" rows=""5"" wrap=""virtual"">" & strMessage & "</textarea></font>" & vbNewLine & _
				"						</td>" & vbNewLine & _
				"						<td width=""10%"">" & vbNewLine & _
				"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & strDate & "</font>" & vbNewLine & _
				"						</td>" & vbNewLine & _
				"						<td width=""5%"">" & vbNewLine & _
				"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & strPoll & "</font>" & vbNewLine & _
				"						</td>" & vbNewLine & _
				"						<td align=""center"" width=""5%"">" & vbNewLine & _
				"							<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><input type=""checkbox"" name=""Unarchive"" value=""" & intTopicID & """></font>" & vbNewLine & _
				"						</td>" & vbNewLine & _
				"		    	</tr>" & vbNewLine
			intI = 1 - intI
			intCounter = intCounter + 1
			rsAT.MoveNext
		Loop
		Response.Write	"		  	</table	>" & vbNewLine & _
			"			</td>" & vbNewLine & _
			"		</tr>" & vbNewLine & _
			"		<tr>" & vbNewLine & _
			"			<td colspan=""7"" align=""center"" style=""line-height:50%;""><br />" & vbNewLine
			"				<input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; font-weight:bold; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:"&strHColor&";"" type=""Submit"" class=""button2"" name=""Search"" value=""Search"" />" & vbNewLine & _
			"				<input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; font-weight:bold; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:"&strHColor&";"" type=""Submit"" class=""button2"" name=""reset"" value=""Clear"" />" & vbNewLine & _
			"			</td>" & vbNewLine & _
			"		</tr>" & vbNewLine & _
			"	</table>" & vbNewLine & _
			"</form><br />" & vbNewLine
	End If
	Set rsAT = Nothing
Else
	Response.Write	"					<tr bgcolor = """ & strForumCellColor & """ vAlign=""top"">" & vbNewLine & _
		"			<td colspan=""7"" align=""center""><br />" & vbNewLine & _
		"				<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>No archived topics found.</font>" & vbNewLine & _
		"			</td>" & vbNewLine & _
		"		</tr>" & vbNewLine & _
		"	</table>" & vbNewLine & _
		"</form><br />" & vbNewLine
End If
If maxpages > 1 Then
	Response.Write	"<table border=""0"" align=""right"">" & vbNewLine & _
		"	<tr>" & vbNewLine
	Call Paging(1)
	Response.Write	"	</tr>" & vbNewLine & _
		"</table>" & vbNewLine
End If
WriteFooter

Sub Paging(fnum)
	If maxpages > 1 Then
		If mypage = "" Then
			sPageNumber = 1
		Else
			sPageNumber = mypage
		End If
		Response.Write	"		<form name=""PageNum" & fnum & """ action=""admin_unarchive.asp"">" & vbNewLine
		If strCond <> "" Then Response.Write	"			<input type=""hidden"" name=""cond"" value=""" & strCond & """>" & vbNewLine
		If strSort <> "" Then Response.Write	"			<input type=""hidden"" name=""sort"" value=""" & strSort & """>" & vbNewLine
		If strWhere <> "" Then Response.Write	"			<input type=""hidden"" name=""where"" value=""" & strWhere & """>" & vbNewLine
		If fnum = 1 Then
			Response.Write	"			<td align=""right"" valign=""bottom""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
		Else
			Response.Write	"			<td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine
		End If
		If fnum = 1 Then
			Response.Write	"				<b>Page: </b><select name=""whichpage"" size=""1"" onchange=""ChangePage(" & fnum & ");"">" & vbNewLine
					Else
			Response.Write	"				<b>Members are " & maxpages & " Pages Long: </b>" & vbNewLine & _
				"					<select name=""whichpage"" size=""1"" onchange=""ChangePage(" & fnum & ");"">" & vbNewLine
		End If
		For counter = 1 to maxpages
			If counter <> cLng(sPageNumber) Then
				Response.Write "						<option value=""" & counter &  """>" & counter & "</option>" & vbNewLine
			Else
				Response.Write "						<option selected value=""" & counter &  """>" & counter & "</option>" & vbNewLine
			End If
		Next
		If fnum = 1 Then
			Response.Write	"					</select><b> of " & maxPages & "</b>" & vbNewLine
		Else
			Response.Write	"					</select>" & vbNewLine
		End If
		Response.Write	"				</font>" & vbNewLine & _
			"			</td>" & vbNewLine & _
			"		</form>" & vbNewLine
	End If
End sub
%>

Edited by - Carefree on 13 August 2015 04:46:45
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 12 August 2015 :  18:31:25  Show Profile  Visit HuwR's Homepage
The script will fail carefree as you are trying to insert records with a TOPIC_ID/REPLY_ID which will fail unless you set IDENTITY_INSERT ON for the tables

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 13 August 2015 :  04:25:28  Show Profile
Actually, if he's running Access, you don't need to. It will work as is, since Access doesn't have an equivalent to IDENTITY_INSERT; also MySQL does it automatically. So I put in a routine to check the DBS type, then added the IDENTITY_INSERT toggles if it's MSSQL.

Edited by - Carefree on 13 August 2015 04:48:14
Go to Top of Page

clatters
Starting Member

United Kingdom
11 Posts

Posted - 13 August 2015 :  10:51:46  Show Profile  Visit clatters's Homepage
Thanks for all of your replies. I appreciate the time you have taken.

Yes, I am running Access and so will give Carefree's script a go on my backup system and see what happens.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 13 August 2015 :  18:11:09  Show Profile  Send ruirib a Yahoo! Message
The problem with this, especially on Access, is if a timeout or an error occurs. If that happens, you will have topics and or replies duplicated elsewhere and you will have to use SQL to get rid of it.

Archiving was always a problem with Access, I have found quite a few databases with multiple copies of topics and replies, and unarchiving is similar, unless you choose to do it a few records at a time.

With SQL Server the problem can be avoided simply by using transactions. With Access or the default MySQL engine, that is simply not possible, but MySQL can handle archiving and unarchiving a lot better, if set operations are used. This does mean not using the vanilla Snitz code.

Sure, a lot of talk and no actual help. Anything on Access will be risky. Huw's posted script, however, should work on Access, too, without the SET IDENTITY_INSERT statements. That would be my first option, which would mean stopping the forum, downloading the database, running the scripts, uploading the database again. However, the set operations as they are performed in Huw's posted script run a lot less risk of failing due to an error or, more likely, from a timeout.

After unarchiving, you will need to perform an update counts operation. On Access, that can easily timeout, as well.



Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 13 August 2015 :  18:57:53  Show Profile
My script allows you to unarchive as many/few topics as you want. So timing out can be avoided with judicious application. It also will automatically transfer to the update counts page upon completion.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 13 August 2015 :  22:58:20  Show Profile  Send ruirib a Yahoo! Message
quote:
Originally posted by Carefree

My script allows you to unarchive as many/few topics as you want. So timing out can be avoided with judicious application. It also will automatically transfer to the update counts page upon completion.


A single timeout and you have duplicates all over the place.

Sorry, Carefree, it's not your fault, you couldn't do any better than you did. This situation cannot be handled in a way guaranteed to work all the time, from an web page (in the case of Access or MySQL using the MyISAM engine). It may even go well in this case, but what I said applies in a more general way. I have cleaned up forums with 4 or 5 copies of topic and replies.

My opinion remains - if we are dealing with a reasonable amount of topics and replies, I would run the SQL directly in the database.



Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 13 August 2015 :  23:34:35  Show Profile
Unfortunately busy site admins typically don't want to shut down, FTP the database, work on it, FTP it back, etc. Some (like Webbo mentioned) don't even have FTP access to their database, so if people identify a need for a web-based tool, I'll keep trying to create one. In this case, end users will just have to keep time limitations in mind and not try to restore 20 million topics simultaneously.

I remember we had a lot of issues with timing out doing newsletters or emailing groups, also. Had to write some work-around for that instance, but can't remember details any more, too many projects ago.
Go to Top of Page

clatters
Starting Member

United Kingdom
11 Posts

Posted - 14 August 2015 :  01:45:38  Show Profile  Visit clatters's Homepage
I don't have time until the weekend to try and run the unarchive script, but when I do I'll be running it on my the development copy of the forum on my local PC. Am I still likely to get time-outs? I would estimate I'm looking at unarchiving around 1000 topics spread over 20 Forums.

My Access database is 45mb and I'm using Access 2007.
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 14 August 2015 :  03:36:50  Show Profile  Visit HuwR's Homepage
You should be ok doing it locally, the issue is when doing it remotely especially using webscripts

MVC .net dev/test site | MVC .net running on Raspberry Pi
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 14 August 2015 :  05:49:54  Show Profile  Send ruirib a Yahoo! Message
quote:
Originally posted by Carefree

Unfortunately busy site admins typically don't want to shut down, FTP the database, work on it, FTP it back, etc. Some (like Webbo mentioned) don't even have FTP access to their database, so if people identify a need for a web-based tool, I'll keep trying to create one. In this case, end users will just have to keep time limitations in mind and not try to restore 20 million topics simultaneously.

I remember we had a lot of issues with timing out doing newsletters or emailing groups, also. Had to write some work-around for that instance, but can't remember details any more, too many projects ago.


Any choice you make always means a compromise somewhere. It's a matter of deciding what you can accept as a consequence.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.5 seconds. Powered By: Snitz Forums 2000 Version 3.4.07