Drupal test sites.

When developing a new site, for anyone you will generally have test and/or development version of a site. These sites are usually exact copies the live site, and from time to time you will copy the live database to these sites.

Usually when doing this you will go through the site and change some of the configuration values, like the gmap api number, and others like the path to payment gateways and credit card gateway indentification numbers to point to test versions of the payment gateways.

Generally doing this by hand you will miss some parameters, and have it really cause problems later. But there is an answer that will allow you to set these values automatically so that depending on the site, will be rewritten correctly everytime.

In the sites directory you will have a directory for each site, and a settings.php file in each of these directories. Just add to your test file the following

$conf = array(
  'site_mail' => [email protected]',
  'ccard_clientid' => 'example_no',
  'ccard_url' => 'https://test.example.com/store/payment/ccard',
  'googlemap_api_key' => 'ABQIAAAAhfBLLoKUHq7LqQ2QBcWQ2hRCSo_fHprJOtfmhc0LOWj7Ebi-6BSINRQq0Kie8sAsQKjO1tEi-ZFxSw',

This will override these values above and will mean that you will never need to change them again. 

Also to speed up the download and update of your local database quickly and if you have a ssh connection to your webserver, try the following.

ssh [email protected] mysqldump -udbuser -pdbpasswd drupaldb | mysql -ulocaldbuser -pdbpasswd localdrupaldb

If you put this into a small shell script it is just a simple command away.

my projects: 


Can This Be Used...

in the following manner:


Instead of duping a live to test/devel multisite for one client, i'm setting up a multisite where each multisite is a sandbox for what will become a completely standalone drupal site.  Often, a new site i want to create is very similar to a multisite that already exists but will be a completely standalone and different site once it goes live.  So i base the new site off of an existing multisite i already have.  I usually just copy the source multisite and rename it to the new site, change my vhosts/alias, create a NEW mysql db, etc...

That saves me time right there. BUT...

Then i have to login to the first screen and then redo all my initial settings for the NEW DB for this site - things like sitename, email, footer message, show slogan, etc...

Since these are all stored in a drupal table that are eventually loaded into drupal vars at runtime.. my thought is if i know what those vars are, i MIGHT be able to set them all from within one place in that settings.php file so i don't have to go in and drill down a bunch of menus to set all of this stuff.  That would be simpler and it would probably be more fullproof as a setting is NOT likely to be missed.


I guess my question is whether or not settings.php would give me access to this functionality via $conf or any other var i might be able to set there..


Also, since that settings.php file is accessed (i think?) every time you "hit" the url of the site, are these $conf vars being hit / reset every time because the FIRST time settings.php is accessed, i imagine these $conf values are written to a db table[s].. yes?


thanks for any help you might provide