CRM-17860 - civicrm.settings.php.template - One settings for normal+headless cfg
authorTim Otten <totten@civicrm.org>
Fri, 22 Jan 2016 09:48:43 +0000 (01:48 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 2 Feb 2016 04:56:23 +0000 (21:56 -0700)
If `CIVICRM_UF` is set before we load `civicrm.settings.php`, it can be used
to switch to headless mode.  All but two settings should be the same.

templates/CRM/common/civicrm.settings.php.template

index 29d4cdfdbd46b515e1bf815e16cccdae4ed1a0c3..f5f4cc2cdf21c59648cf6b62bcef7cba33c55e6d 100644 (file)
@@ -64,7 +64,7 @@ if (!defined('CIVICRM_UF')) {
  * Datasource (DSN) format:
  *      define( 'CIVICRM_UF_DSN', 'mysql://cms_db_username:cms_db_password@db_server/cms_database?new_link=true');
  */
-if (!defined('CIVICRM_UF_DSN')) {
+if (!defined('CIVICRM_UF_DSN') && CIVICRM_UF !== 'UnitTests') {
   define( 'CIVICRM_UF_DSN'           , 'mysql://%%CMSdbUser%%:%%CMSdbPass%%@%%CMSdbHost%%/%%CMSdbName%%?new_link=true');
 }
 
@@ -89,7 +89,12 @@ if (!defined('CIVICRM_UF_DSN')) {
  *
  */
 if (!defined('CIVICRM_DSN')) {
-  define( 'CIVICRM_DSN'          , 'mysql://%%dbUser%%:%%dbPass%%@%%dbHost%%/%%dbName%%?new_link=true');
+  if (CIVICRM_UF !== 'UnitTests') {
+    define('CIVICRM_DSN', 'mysql://%%dbUser%%:%%dbPass%%@%%dbHost%%/%%dbName%%?new_link=true');
+  }
+  else {
+    define('CIVICRM_DSN', 'mysql://%%testUser%%:%%testPass%%@%%testHost%%/%%testName%%?new_link=true');
+  }
 }
 
 /**