|
I usually recommend handling it like this: - Setup a subdomain on the same VPS. * copy all the code to the subdirectory. * make a copy of the DB and rename it accordingly. * modify your DB connection info so it points to the test DB. ^^^ be sure NOT to copy the edited DB connection when merging the new code with the existing site. * do your thing.
I use the above method for major updates or reworking of an entire site. For other changes I use our init stub magic that lets me modify and test code on a live site without disturbing it for site visitors. I can set cookies or URL parameters that give me access to testing & debug functionality. It can display debug info on the page and/or in the browser console, but only to me. It allows me to use alternate source, include or library files & locations, and different owner, site, directory or page config files, etc. This way I don't break the site even with syntax errors, coding or logic errors, or code that crashes.
If I have special nav items for testing or config pages they're added to the menus. It can load alternate or suplemental style sheets. It adds a special javascript file to the page that has some test routines in it. It can even add data or other info to the title attributes of HTML tags if I need it to (hover is my friend).
My DB code wrappers check for test variables and automatically add a prefix to the DB name or table names. My DB error routines only provide an error reference number to a normal site visitor, but in debug mode I get all the gory details.
It's a lot of help when trying to hunt down bugs, testing alternate styles or presentations of the data, adding pages or features, or refining or refactoring code. Without the debug items enabled it functions as a test site for training or a demo site without exposing a client's data.
|