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

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 admin_compactdb.asp
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 05 September 2002 :  12:56:40  Show Profile
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  Show Profile
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.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 07 September 2002 :  07:52:53  Show Profile  Send ruirib a Yahoo! Message
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
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 07 September 2002 :  08:01:04  Show Profile
I wonder why we aren't just using the database directory for this? Seems like it would be the best choice.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 07 September 2002 :  09:23:42  Show Profile  Send ruirib a Yahoo! Message
That would be a good possibility. It is simple to find out that folder from the connection string, and that folder already has all the required permissions.


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

alex042
Average Member

USA
631 Posts

Posted - 07 September 2002 :  10:29:58  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
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
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 07 September 2002 :  10:45:51  Show Profile
Richard, this is something we discussed with Huw recently in the Dev Team only forum. It would be worth to read it also: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=31543&SearchTerms=admin_compactdb.asp

Stop the WAR!
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 08 September 2002 :  23:35:26  Show Profile
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 ~
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 09 September 2002 :  03:56:18  Show Profile
sure, you can post it here.
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 09 September 2002 :  07:27:10  Show Profile
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 ~
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 09 September 2002 :  13:05:30  Show Profile
would there really be a need to create a tools directory?
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 09 September 2002 :  13:18:14  Show Profile  Send ruirib a Yahoo! Message
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
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 09 September 2002 :  13:24:33  Show Profile
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
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 12 September 2002 :  01:29:53  Show Profile
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)
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 12 September 2002 :  09:18:54  Show Profile
seems to work fine for me. did you get rid of the Tools folder?

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 12 September 2002 :  16:06:41  Show Profile
yes
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07