<%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "343, 344, 345, 346, 347, 348, 349, 1065" strThisBackPage = "config" %> <% '=============================================== ' CactuShop ASP Shopping Cart ' ©1999-2004 Cactusoft Ltd. www.cactusoft.com '=============================================== ' All rights reserved. ' Use of this code is covered by the terms and ' conditions in the license agreement. No ' unauthorized duplication or distribution is ' permitted. Cactusoft's copyright notices must ' remain in the ASP sections of the code. '=============================================== If strDatabaseType = "mssql" Then Response.Redirect("_default.asp") End If %> <% =GetString("Config_headtitle") %>
<% WriteString("PageTitle_CompactingDB") %>
<% '----------------------------------------------- 'THEN COMPACT THE DATABASE '----------------------------------------------- Response.Write "
    " & vbCrLf If strDatabaseType = "access" Then Dim fso, Engine, strDbPath Set fso = CreateObject("Scripting.FileSystemObject") Set Engine = CreateObject("JRO.JetEngine") strDbPath = server.mappath(strPathToDatabase) strDbPathTemp1 = left(strDbPath,instrrev(strDbPath,"\")) & "temp1.mdb" strDbPathTemp2 = left(strDbPath,instrrev(strDbPath,"\")) & "temp2.mdb" '----------------------------------------------- 'FIRST LOCKUP THE SHOP 'If the shop is currently open '----------------------------------------------- If Application(LICENSENUMBER & "shopstatus") <> "locked" then WriteString("ContentText_ShopClosed") Application(LICENSENUMBER & "shopstatus")="locked" blnWasOpen = true else blnWasOpen = False end if '----------------------------------------------- 'COPY FILE TO TEMP LOCATION '----------------------------------------------- fso.CopyFile strDbPath,strDbPathTemp1 '----------------------------------------------- 'COMPACT THE DATABASE '----------------------------------------------- Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDbPathTemp1 & ";Jet OLEDB:Database Password=" & strDatabasePassword, _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDbPathTemp2 WriteString("ContentText_DBCompacted") '----------------------------------------------- 'COPY ACROSS THE NEW COMPACTED DATABASE '----------------------------------------------- fso.CopyFile strDbPathTemp2,strDbPath WriteString("ContentText_NewCompactedDBCopied") '----------------------------------------------- ' DELETE THE TEMP FILES '----------------------------------------------- fso.DeleteFile strDbPathTemp1 fso.DeleteFile strDbPathTemp2 WriteString("ContentText_TempFilesDeleted") Set fso = nothing Set Engine = nothing '----------------------------------------------- 'NOW RE-OPEN THE SHOP (IF IT WAS FIRST CLOSED) '----------------------------------------------- If blnWasOpen = True then Application(LICENSENUMBER & "shopstatus")="open" WriteString("ContentText_ShopReopened") end if ElseIf strDatabaseType = "mysql" Then 'Do MySQL stuff... '----------------------------------------------- 'FIRST LOCKUP THE SHOP '----------------------------------------------- If Application(LICENSENUMBER & "shopstatus") <> "locked" then WriteString("ContentText_ShopClosed") Application(LICENSENUMBER & "shopstatus")="locked" blnWasOpen = true else blnWasOpen = False end if '----------------------------------------------- 'COMPACT EACH TABLE... '----------------------------------------------- WriteString("ContentText_OptimiseTables") Call ExecuteSQL("OPTIMIZE TABLE `tblcactushopaffiliatelog`, `tblcactushopaffiliatepayments`, `tblcactushopaffiliates`, `tblcactushopcardholderdetails`, `tblcactushopconfig`, `tblcactushopcoupons`, `tblcactushopcreditcards`, `tblcactushopcurrencies`, `tblcactushopdestination`, `tblcactushopinvoicerows`, `tblcactushoplanguages`, `tblcactushoplanguagestrings1`, `tblcactushoplanguagestrings2`, `tblcactushoplanguagestrings3`, `tblcactushoplanguagestrings4`, `tblcactushoplanguagestrings5`, `tblcactushoplogins`, `tblcactushopmailinglist`, `tblcactushopnews`, `tblcactushopordernumbers`, `tblcactushopprodtype`, `tblcactushopproductprodtypelink`, `tblcactushopproducts`, `tblcactushopproductstats`, `tblcactushoprelatedproducts`, `tblcactushopsavebasket`, `tblcactushopshippingmethods`, `tblcactushopshippingrates`, `tblcactushoptaxrates`, `tblcactushopups`, `tblcactushopversions`, `tblcactushopversionsalesstats`, `tblcactushopwishlist`", numCursorType, objRecordSet) '----------------------------------------------- 'NOW RE-OPEN THE SHOP (IF IT WAS FIRST CLOSED) '----------------------------------------------- If blnWasOpen = True then Application(LICENSENUMBER & "shopstatus")="open" WriteString("ContentText_ShopReopened") end if End If Response.Write "
" %>
<% WriteString("ContentText_CompactComplete") %>