wp-config switch
-
I recently thought I’d simplify the process of migrating updates to sites from my local to a staging and finally to a production server by adding a switch to the wp-config to switch DB’s and in some cases FTP settings. This works great when using FTP alone.
However I’ve discovered that Duplicator ignores my switch case’s and updates every instance of DB_NAME, DB_USER, DB_PASSWORD, etc…
I’m considering just creating a wp-config.switch file and then just copying and pasting the contents each time I migrate. Not elegant but….
Would y’all consider some logic to NOT override the switch? Or perhaps there’s a setting I’m missing?
// ** MySQL settings - You can get this info from your web host ** // switch($_SERVER['HTTP_HOST']) { /* DEVELOPMENT */ case 'dev.mysite.com': /** The name of the database for WordPress */ define('DB_NAME', 'wpdev_mysite'); /** MySQL database username */ define('DB_USER', 'dev_username'); /** MySQL database password */ define('DB_PASSWORD', 'dev_password'); /** MySQL hostname */ define('DB_HOST', 'localhost'); break; /* STAGING */ case 'stage.mysite.com': /** The name of the database for WordPress */ define('DB_NAME', 'wpstage_mysite'); /** MySQL database username */ define('DB_USER', 'stage_username'); /** MySQL database password */ define('DB_PASSWORD', 'stage_password'); /** MySQL hostname */ define('DB_HOST', 'localhost'); break; /* PRODUCTION */ case 'mysite.com': /** The name of the database for WordPress */ define('DB_NAME', 'wpprod_mysite'); /** MySQL database username */ define('DB_USER', 'username'); /** MySQL database password */ define('DB_PASSWORD', 'password'); /** MySQL hostname */ define('DB_HOST', 'localhost'); break; default: break;
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘wp-config switch’ is closed to new replies.