Log in

View Full Version : Clone GLOBAL.PHP


tHE DSS
08-25-2002, 10:37 PM
I would like to make a copy of vB's 'global.php' script, cut it down a little, and also do the same to the scripts called from within it.

It's for another section of a website - i'll be leaving the forums scripts 100% in-tact (apart from hacks, of course).

Mainly, i'd like to supress errors with this modified script, so that if there is a database failure/error on the forums, this other section of the site can continue, and output it's own messages.

Has anyone done anything like this without problems? Or does anyone know of any problems that might occur?

My main concern is the 'DB_Site->' name - would I be causing any problem conflicts by using a 2nd global.php?

NTLDR
08-25-2002, 10:41 PM
Originally posted by tHE DSS
My main concern is the 'DB_Site->' name - would I be causing any problem conflicts by using a 2nd global.php?

Should't cause any conflicts, this is just the string used by vB to perform queries and can probably be easily changed if you wanted to.

g-force2k2
08-25-2002, 11:04 PM
DSS just don't include two files that are requiring similiar globals or it could cause some issues... makes sure that you keep them seperate ;)

g-force2k2

tHE DSS
08-25-2002, 11:43 PM
If I was to change the bit in my cloned and modified scripts where the instance of the database "and all that jazz" class is created, like this, for example :

change this :

$DB_site=new DB_Sql_vb;

to this :

$DB_clone=new DB_Sql_vb;

.... then I could use the $DB_clone, without much hassle?

There be no conflicts with database connections, or anything of the sort?

NTLDR
08-26-2002, 12:13 AM
Originally posted by tHE DSS
.... then I could use the $DB_clone, without much hassle? There be no conflicts with database connections, or anything of the sort?

That seems to be the only changed thats required, so you just use $DB_clone in the files that require the clone (and the clone itself!) as oposed to using $DB_site.

**** NOTE ****

That files that are inluded within this one (if required) ie admin/functions.php would also need to be changed to use $DB_clone

tHE DSS
08-26-2002, 12:18 AM
Seems pretty safe then.

Nice one.... I'll get working on it tomorrow, now my fears are cleared up.

Thanks again. ;)