%
'#################################################################################
'## Copyright (C) 2000-02 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 any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## 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 the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
%>
<%
if Session(strCookieURL & "Approval") <> "15916941253" then
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname))
end if
Response.Write "
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","") & " All Forums " & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpen,"","") & " Admin Section " & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","") & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpen,"","") & " Forum Deletion/Archival " & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","") & getCurrentIcon(strIconBlank,"","") & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Compact Database
| " & vbNewLine & _
"
" & vbNewLine & _
"
" & vbNewLine & _
"
" & vbNewLine
strForumDB = getForumDB()
strForumDB = replace(strForumDB,";","",1,1)
strDBPath = Left(strForumDB,InStrRev(strForumDB,"\"))
strTempFile = strDBPath & "Snitz_compacted.mdb"
DBFolderExists = CheckDBFolder(strDBPath)
if Application(strCookieURL & "down") then
status = "Closed"
else
status = "Open"
end if
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" | Administrative Forum Archive Functions - Compact DB | " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" | " & vbNewLine
if request.querystring("action") = "" then
Response.Write " Depending on security settings at your Host, these operations may or may not be successful. However, no harm should befall your data " & vbNewLine & _
" Your original database will be copied to:
" & left(strForumDB,len(strForumDB)-4) & "_" & DateToStr(strForumTimeadjust) & ".bak" & "
as a backup and then compacted to:
" & strTempFile & " " & vbNewLine & _
" " & vbNewLine & _
" If these steps are successful, the original DB will be replaced by the compacted DB. " & vbNewLine & _
" " & vbNewLine & _
" This may take some time depending on the size of your database. " & vbNewLine & _
" " & vbNewLine & _
" You will have to CLOSE the forum while the database is being compacted.
" & vbNewLine & _
" Current Status of Forum: " & status & "
" & vbNewLine
if Application(strCookieURL & "down") then
Response.Write " Are you sure you want to compact the database? " & vbNewLine & _
" Yes No" & vbNewLine
else
Response.Write " Click here to close the forum before you start." & vbNewLine
end if
elseif request.querystring("action") = "No" then
Response.Write " You have chosen not to compact your database. You can compact your database at a later time.
" & vbNewLine & _
" You will need to open your forums before you continue. " & vbNewLine & _
" Click here to open your forum. " & vbNewLine
elseif request.querystring("action") = "Yes" then
my_conn.close
strTempConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strTempFile
if DBFolderExists = false then
Response.Write "
Unable to create folder: " & strDBPath & ". " & vbNewLine
else
if BackupDB(strForumDB) then
set jro = server.createobject("jro.JetEngine")
jro.CompactDatabase strConnString, strTempConnString
if err <> 0 then
bError = True
Response.Write " Error Compacting: " & err.description & vbNewLine
else
Response.Write "
Database Compacted successfully. " & vbNewLine
end if
if not bError then
if not RenameFile( strTempFile, strForumDB) then
Response.Write " Error Replacing: " & err.description & vbNewLine
else
Response.Write "
Database renamed successfully. " & vbNewLine
end if
end if
else
Response.Write "
Unable to back up database " & vbNewLine
end if
end if
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
Response.Write " Re-open Forum " & vbNewLine
end if
Response.Write " | " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" | " & vbNewLine & _
"
" & vbNewLine & _
"
" & vbNewLine & _
"
" & vbNewLine
'if Application(strCookieURL & "down") then
'Response.Write " Open Forum
" & vbNewLine
Response.Write " Back to Forums Administration
" & vbNewLine
'end if
Response.Write "
" & vbNewLine & _
"
" & vbNewLine
WriteFooter
Response.End
Function RenameFile(sFrom, sTo)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
if err.number <> 0 then
RenameFile = False
Exit Function
end if
fso.DeleteFile sTo,true
fso.MoveFile sFrom, sTo
set fso = nothing
RenameFile = True
end Function
Function BackupDB(sFrom)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
if err.number <> 0 then
BackupDB = False
Exit Function
end if
fso.CopyFile sFrom, fso.GetParentFolderName(sFrom) & "\" & fso.GetBaseName(sFrom) & "_" & DateTostr(strForumTimeAdjust) & ".bak", true
set fso = nothing
BackupDB = True
end Function
Function GetForumDB()
dim tmpFileName
tmpFileName = split(strConnstring,"Source=",2,1)
GetForumDB = tmpFileName(1)
end Function
Function CheckDBFolder(strPath)
Dim fso, blnExists
Set fso = CreateObject("Scripting.FileSystemObject")
if err.number <> 0 then
CheckDBFolder = False
Exit Function
end if
blnExists = fso.FolderExists(strPath)
if blnExists = false then
fso.CreateFolder(strPath)
CheckDBFolder = True
else
CheckDBFolder = True
end if
End Function
%>