Author |
Topic |
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 05 September 2002 : 12:56:40
|
Per Davio in this topic: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=34310 I am reporting a possible bug in admin_compactdb.asp.
The compactdb script uses Server.MapPath to find and create the tools folder as well as to create the backup database. Since my database is located outside wwwroot, I use a physical path to locate the database. I get a permission denied error when running the script because (I assume) the script is trying to create the tools folder inside the wwwroot.
To get the script to work, I just replace all instance of Server.MapPath with an actual path and it worked fine. |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 07 September 2002 : 07:40:23
|
Not really sure exactly how to fix this. I guess the best thing would be to allow the Admin to choose the path to the folder. Will have to think about this. Did Davio have any thoughts on this? He worked on this file during development of v3.4. |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 07 September 2002 : 07:52:53
|
One way to do it would maybe add another connection string in config.asp, just to make sure users with specify it in a similar manner to the original strConnString. It's pretty similar to your proposal about having the admin choose the path, but the path to the original string would be there for them to have a look, thus avoiding certain problems with it.
Just an idea. |
Snitz 3.4 Readme | Like the support? Support Snitz too |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 07 September 2002 : 08:01:04
|
I wonder why we aren't just using the database directory for this? Seems like it would be the best choice. |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
alex042
Average Member
USA
631 Posts |
Posted - 07 September 2002 : 10:29:58
|
quote: I guess the best thing would be to allow the Admin to choose the path to the folder.
One way to do it would maybe add another connection string in config.asp
I wonder why we aren't just using the database directory for this? Seems like it would be the best choice.
How about adding a couple of variables in the config.asp? Something like: strConnString = strDBPath & strDBName . The strDBPath could be used as the default path for the database folder to backup and compact the database and the StrDBName could identify the DB to be compacted.
|
Edited by - alex042 on 07 September 2002 13:32:17 |
|
|
Deleted
deleted
4116 Posts |
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 08 September 2002 : 23:35:26
|
I have modifications for this that work on my forum and should also work with server.mappath, but I haven't tested it using a connstring with server.mappath. Also, seems like using a tools folder is unnecessary, but I left the script so that it uses the tools folder. Shall I paste the code? |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 09 September 2002 : 03:56:18
|
sure, you can post it here. |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 09 September 2002 : 07:27:10
|
Alright. I'm not quite sure of line numbers, but since the file is small, it should be easy to figure out what I'm doing.
First, here's the chuck of code right before the script checks if the Application is down. Changes in green.
'strTempFile = Server.MapPath("tools\Snitz_compacted.mdb")
strForumDB = getForumDB()
strForumDB = replace(strForumDB,";","",1,1)
strDBPath = Left(strForumDB,InStrRev(strForumDB,"\"))
strTempFile = strDBPath & "tools\Snitz_compacted.mdb"
DBFolderExists = CheckDBFolder(strDBPath) Find strTempConnString. Replace with:
strTempConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "tools\Snitz_compacted.mdb" Then the ChkDBFolder function is:
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 & "tools")
if blnExists = false then
fso.CreateFolder(strPath & "tools")
CheckDBFolder = True
else
CheckDBFolder = True
end if
End Function |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 09 September 2002 : 13:05:30
|
would there really be a need to create a tools directory? |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 09 September 2002 : 13:18:14
|
Why is the compacted DB created in the tools folder? I can't see a reason for that.
<edit>Just noticed that Richard thinks the same...</edit> |
Snitz 3.4 Readme | Like the support? Support Snitz too |
Edited by - ruirib on 09 September 2002 13:26:08 |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 09 September 2002 : 13:24:33
|
I don't really see why a tools folder is needed. It's just an extra step to go through. Plus, there may be problems with permissions on a newly created folder and copying and pasting files into and out of it; depending on the operating system of course. |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
Edited by - Nikkol on 09 September 2002 13:31:19 |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 12 September 2002 : 01:29:53
|
here is an updated admin_compactdb.asp file, if y'all could try it out and see if it works, that would be great!
http://kinser.121hosts.net/files/admin_compactdb.zip
(btw, I've moved this to the DEV Discussions (General) Forum) |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 12 September 2002 : 16:06:41
|
yes |
|
|
|
Topic |
|