Created
August 27, 2013 21:39
-
-
Save digisavvy/6359522 to your computer and use it in GitHub Desktop.
Allows dynamic switching of database credentials based on the current defined site URL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ** MySQL settings - You can get this info from your web host ** // | |
/** DB switch statement */ | |
$wufunc_getServName = $_SERVER['SERVER_NAME']; | |
switch ($i) { | |
case 'localdev.siteurl.com': | |
/** JH local */ | |
define('DB_NAME', 'database-name'); | |
/** MySQL database username */ | |
define('DB_USER', 'database-user'); | |
/** MySQL database password */ | |
define('DB_PASSWORD', 'database-password'); | |
/** MySQL hostname */ | |
define('DB_HOST', 'localhost'); | |
break; | |
case 'stageserver.siteurl.com': | |
/** STAGEWP */ | |
define('DB_NAME', 'wpress'); | |
/** MySQL database username */ | |
define('DB_USER', 'web_admin'); | |
/** MySQL database password */ | |
define('DB_PASSWORD', 'password'); | |
/** MySQL hostname */ | |
define('DB_HOST', 'stagedb-host'); | |
break; | |
default: | |
/** PRODUCTION */ | |
define('DB_NAME', 'database-name'); | |
/** MySQL database username */ | |
define('DB_USER', 'database-user'); | |
/** MySQL database password */ | |
define('DB_PASSWORD', 'database-password'); | |
/** MySQL hostname */ | |
define('DB_HOST', 'localhost'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment