civicrm.settings.php.template, ExternalBatch - Read unit test DSN from $_CV
[civicrm-core.git] / templates / CRM / common / civicrm.settings.php.template
CommitLineData
eb049397
DL
1<?php
2/*
3 +--------------------------------------------------------------------+
3435af9a 4 | CiviCRM version 4.7 |
eb049397 5 +--------------------------------------------------------------------+
e7112fa7 6 | Copyright CiviCRM LLC (c) 2004-2015 |
eb049397
DL
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26*/
27
28/**
29 * CiviCRM Configuration File.
30 */
31
32/**
33 * Content Management System (CMS) Host:
34 *
35 * CiviCRM can be hosted in either Drupal 6 or 7, Joomla or WordPress.
36 *
83cac775 37 * Settings for Backdrop CMS:
92b1c24f 38 * define( 'CIVICRM_UF' , 'Backdrop');
83cac775 39 *
eb049397 40 * Settings for Drupal 7.x:
92b1c24f 41 * define( 'CIVICRM_UF' , 'Drupal');
eb049397
DL
42 *
43 * Settings for Drupal 6.x:
23b5a711 44 * define( 'CIVICRM_UF' , 'Drupal6');
eb049397
DL
45 *
46 * Settings for Joomla 1.7.x - 2.5.x:
23b5a711 47 * define( 'CIVICRM_UF' , 'Joomla');
eb049397
DL
48 *
49 * Settings for WordPress 3.3.x:
23b5a711 50 * define( 'CIVICRM_UF' , 'WordPress');
eb049397
DL
51 *
52 * You may have issues with images in CiviCRM. If this is the case, be sure
53 * to update the CiviCRM Resource URL field to your CiviCRM root directory
54 * (Administer::System Settings::Resource URLs).
55 */
8d133ef2 56if (!defined('CIVICRM_UF')) {
0a4cd490
TO
57 if (getenv('CIVICRM_UF')) {
58 define('CIVICRM_UF', getenv('CIVICRM_UF'));
59 }
60 else {
61 define('CIVICRM_UF', '%%cms%%');
62 }
8d133ef2 63}
eb049397
DL
64
65/**
66 * Content Management System (CMS) Datasource:
67 *
92b1c24f 68 * Update this setting with your CMS (Drupal, Backdrop CMS, or Joomla) database username, server and DB name.
eb049397
DL
69 * Datasource (DSN) format:
70 * define( 'CIVICRM_UF_DSN', 'mysql://cms_db_username:cms_db_password@db_server/cms_database?new_link=true');
71 */
844b94bd 72if (!defined('CIVICRM_UF_DSN') && CIVICRM_UF !== 'UnitTests') {
23b5a711 73 define( 'CIVICRM_UF_DSN' , 'mysql://%%CMSdbUser%%:%%CMSdbPass%%@%%CMSdbHost%%/%%CMSdbName%%?new_link=true');
8d133ef2 74}
eb049397
DL
75
76/**
77 * CiviCRM Database Settings
78 *
79 * Database URL (CIVICRM_DSN) for CiviCRM Data:
80 * Database URL format:
81 * define( 'CIVICRM_DSN', 'mysql://crm_db_username:crm_db_password@db_server/crm_database?new_link=true');
82 *
83 * Drupal and CiviCRM can share the same database, or can be installed into separate databases.
92b1c24f 84 * Backdrop CMS and CiviCRM can also share the same database, or can be installed into separate databases.
eb049397 85 *
92b1c24f
JL
86 * EXAMPLE: Drupal/Backdrop and CiviCRM running in the same database...
87 * DB Name = cms, DB User = cms
88 * define( 'CIVICRM_DSN' , 'mysql://cms:YOUR_PASSWORD@localhost/cms?new_link=true');
eb049397 89 *
92b1c24f
JL
90 * EXAMPLE: Drupal/Backdrop and CiviCRM running in separate databases...
91 * CMS DB Name = cms, DB User = cms
eb049397 92 * CiviCRM DB Name = civicrm, CiviCRM DB User = civicrm
23b5a711 93 * define( 'CIVICRM_DSN' , 'mysql://civicrm:YOUR_PASSWORD@localhost/civicrm?new_link=true');
eb049397
DL
94 *
95 */
8d133ef2 96if (!defined('CIVICRM_DSN')) {
2b045ddd
TO
97 if (CIVICRM_UF === 'UnitTests' && isset($GLOBALS['_CV']['TEST_DB_DSN'])) {
98 define('CIVICRM_DSN', $GLOBALS['_CV']['TEST_DB_DSN']);
844b94bd
TO
99 }
100 else {
2b045ddd 101 define('CIVICRM_DSN', 'mysql://%%dbUser%%:%%dbPass%%@%%dbHost%%/%%dbName%%?new_link=true');
844b94bd 102 }
8d133ef2 103}
eb049397
DL
104
105/**
106 * CiviCRM Logging Database
107 *
108 * Used to point to a different database to use for logging (if desired). If unset defaults to equal CIVICRM_DSN.
109 * The CIVICRM_DSN user needs to have the rights to modify the below database schema and be able to write to it.
110 */
8d133ef2
TO
111if (!defined('CIVICRM_LOGGING_DSN')) {
112 define('CIVICRM_LOGGING_DSN', CIVICRM_DSN);
113}
eb049397
DL
114
115/**
116 * File System Paths:
117 *
118 * $civicrm_root is the file system path on your server where the civicrm
119 * code is installed. Use an ABSOLUTE path (not a RELATIVE path) for this setting.
120 *
121 * CIVICRM_TEMPLATE_COMPILEDIR is the file system path where compiled templates are stored.
122 * These sub-directories and files are temporary caches and will be recreated automatically
123 * if deleted.
124 *
125 * IMPORTANT: The COMPILEDIR directory must exist,
126 * and your web server must have read/write access to these directories.
127 *
128 *
129 * EXAMPLE - Drupal:
130 * If the path to the Drupal home directory is /var/www/htdocs/drupal
131 * the $civicrm_root setting would be:
132 * $civicrm_root = '/var/www/htdocs/drupal/sites/all/modules/civicrm/';
133 *
134 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
23b5a711 135 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/drupal/sites/default/files/civicrm/templates_c/');
eb049397 136 *
92b1c24f
JL
137 * EXAMPLE - Backdrop CMS:
138 * If the path to the Backdrop home directory is /var/www/htdocs/backdrop
139 * the $civicrm_root setting would be:
140 * $civicrm_root = '/var/www/htdocs/backdrop/modules/civicrm/';
141 *
142 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
143 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/backdrop/files/civicrm/templates_c/');
144 *
eb049397
DL
145 * EXAMPLE - Joomla Installations:
146 * If the path to the Joomla home directory is /var/www/htdocs/joomla
147 * the $civicrm_root setting would be:
148 * $civicrm_root = '/var/www/htdocs/joomla/administrator/components/com_civicrm/civicrm/';
149 *
150 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
23b5a711 151 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/joomla/media/civicrm/templates_c/');
eb049397
DL
152 *
153 * EXAMPLE - WordPress Installations:
750752f2 154 * If the path to the WordPress home directory is /var/www/htdocs/wordpress and the path to the plugin directory is /var/www/htdocs/wordpress/wp-content/plugins
eb049397
DL
155 * the $civicrm_root setting would be:
156 * $civicrm_root = '/var/www/htdocs/wordpress/wp-content/plugins/civicrm/civicrm/';
157 *
158 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
750752f2 159 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/wordpress/wp-content/uploads/civicrm/templates_c/');
eb049397
DL
160 *
161 */
162
163global $civicrm_root;
164
165$civicrm_root = '%%crmRoot%%';
8d133ef2 166if (!defined('CIVICRM_TEMPLATE_COMPILEDIR')) {
23b5a711 167 define( 'CIVICRM_TEMPLATE_COMPILEDIR', '%%templateCompileDir%%');
8d133ef2 168}
eb049397
DL
169
170/**
171 * Site URLs:
172 *
92b1c24f 173 * This section defines absolute and relative URLs to access the host CMS (Backdrop, Drupal, or Joomla) resources.
eb049397
DL
174 *
175 * IMPORTANT: Trailing slashes should be used on all URL settings.
176 *
177 *
178 * EXAMPLE - Drupal Installations:
179 * If your site's home url is http://www.example.com/drupal/
180 * these variables would be set as below. Modify as needed for your install.
181 *
182 * CIVICRM_UF_BASEURL - home URL for your site:
23b5a711 183 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/drupal/');
eb049397 184 *
92b1c24f
JL
185 * EXAMPLE - Backdrop CMS Installations:
186 * If your site's home url is http://www.example.com/backdrop/
187 * these variables would be set as below. Modify as needed for your install.
188 *
189 * CIVICRM_UF_BASEURL - home URL for your site:
190 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/backdrop/');
191 *
eb049397
DL
192 * EXAMPLE - Joomla Installations:
193 * If your site's home url is http://www.example.com/joomla/
194 *
195 * CIVICRM_UF_BASEURL - home URL for your site:
196 * Administration site:
23b5a711 197 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/joomla/administrator/');
eb049397 198 * Front-end site:
23b5a711 199 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/joomla/');
eb049397
DL
200 *
201 */
8d133ef2 202if (!defined('CIVICRM_UF_BASEURL')) {
23b5a711 203 define( 'CIVICRM_UF_BASEURL' , '%%baseURL%%');
8d133ef2 204}
eb049397 205
32799d94
EM
206/**
207 * Define any CiviCRM Settings Overrides per http://wiki.civicrm.org/confluence/display/CRMDOC/Override+CiviCRM+Settings
208 *
209 * Uncomment and edit the below as appropriate.
210 */
211 // Add this line only once above any settings overrides.
212 // global $civicrm_setting;
213
214 // Override the Temporary Files directory.
215 // $civicrm_setting['Directory Preferences']['customFileUploadDir'] = '/path/to/upload';
216
217 // Override the custom files upload directory.
218 // $civicrm_setting['Directory Preferences']['uploadDir'] = '/path/to/upload-dir' ;
219
220 // Override the images directory.
221 // $civicrm_setting['Directory Preferences']['imageUploadDir'] = '/path/to/image-upload-dir' ;
222
223 // Override the custom templates directory.
224 // $civicrm_setting['Directory Preferences']['customTemplateDir'] = '/path/to/template-dir';
225
226 // Override the Custom php path directory.
227 // $civicrm_setting['Directory Preferences']['customPHPPathDir'] = '/path/to/custom-php-dir';
228
229 // Override the extensions directory.
230 // $civicrm_setting['Directory Preferences']['extensionsDir'] = '/path/to/extensions-dir';
231
232 // Override the resource url
233 // $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = 'http://example.com/example-resource-url/';
234
235 // Override the Image Upload URL (System Settings > Resource URLs)
236 // $civicrm_setting['URL Preferences']['imageUploadURL'] = 'http://example.com/example-image-upload-url';
237
238 // Override the Custom CiviCRM CSS URL
239 // $civicrm_setting['URL Preferences']['customCSSURL'] = 'http://example.com/example-css-url' ;
240
241 // Override the extensions resource URL
242 // $civicrm_setting['URL Preferences']['extensionsURL'] = 'http://example.com/pathtoextensiondir'
243
244 // Disable display of Community Messages on home dashboard
245 // $civicrm_setting['CiviCRM Preferences']['communityMessagesUrl'] = false;
246
247 // Disable automatic download / installation of extensions
248 // $civicrm_setting['Extension Preferences']['ext_repo_url'] = false;
249
f7732cb7
KC
250 // Override the CMS root path defined by cmsRootPath.
251 // define('CIVICRM_CMSDIR', '/path/to/install/root/');
252
253
32799d94 254/**
eb049397
DL
255 * If you are using any CiviCRM script in the bin directory that
256 * requires authentication, then you also need to set this key.
257 * We recommend using a 16-32 bit alphanumeric/punctuation key.
258 * More info at http://wiki.civicrm.org/confluence/display/CRMDOC/Command-line+Script+Configuration
259 */
8d133ef2 260if (!defined('CIVICRM_SITE_KEY')) {
23b5a711 261 define( 'CIVICRM_SITE_KEY', '%%siteKey%%');
8d133ef2 262}
eb049397
DL
263
264/**
265 * Enable this constant, if you want to send your email through the smarty
266 * templating engine(allows you to do conditional and more complex logic)
267 *
268 */
8d133ef2
TO
269if (!defined('CIVICRM_MAIL_SMARTY')) {
270 define( 'CIVICRM_MAIL_SMARTY', 0 );
271}
eb049397
DL
272
273/**
274 * This setting logs all emails to a file. Useful for debugging any mail (or civimail) issues.
275 * Enabling this setting will not send any email, ensure this is commented out in production
276 * The CIVICRM_MAIL_LOG is a debug option which disables MTA (mail transport agent) interaction.
277 * You must disable CIVICRM_MAIL_LOG before CiviCRM will talk to your MTA.
278 */
8d133ef2 279// if (!defined('CIVICRM_MAIL_LOG')) {
23b5a711 280// define( 'CIVICRM_MAIL_LOG', '%%templateCompileDir%%/mail.log');
8d133ef2 281// }
eb049397 282
8d133ef2
TO
283
284if (!defined('CIVICRM_DOMAIN_ID')) {
23b5a711 285 define( 'CIVICRM_DOMAIN_ID', 1);
8d133ef2 286}
eb049397
DL
287
288/**
59e56021 289 * Settings to enable external caching using a cache server. This is an
eb049397
DL
290 * advanced feature, and you should read and understand the documentation
291 * before you turn it on. We cannot store these settings in the DB since the
292 * config could potentially also be cached and we need to avoid an infinite
293 * recursion scenario.
294 *
295 * @see http://civicrm.org/node/126
296 */
297
298/**
59e56021
H
299 * If you have a cache server configured and want CiviCRM to make use of it,
300 * set the following constant. You should only set this once you have your cache
eb049397
DL
301 * server up and working, because CiviCRM will not start up if your server is
302 * unavailable on the host and port that you specify. By default CiviCRM will use
303 * an in-memory array cache
304 *
305 * To use the php extension memcache use a value of 'Memcache'
306 * To use the php extension memcached use a value of 'Memcached'
307 * To use the php extension apc use a value of 'APCcache'
59e56021 308 * To use the php extension redis use a value of 'Redis'
eb049397
DL
309 * To not use any caching (not recommended), use a value of 'NoCache'
310 *
311 */
8d133ef2 312if (!defined('CIVICRM_DB_CACHE_CLASS')) {
23b5a711 313 define('CIVICRM_DB_CACHE_CLASS', 'ArrayCache');
8d133ef2 314}
eb049397
DL
315
316/**
317 * Change this to the IP address of your cache server if it is not on the
318 * same machine (Unix).
319 */
8d133ef2 320if (!defined('CIVICRM_DB_CACHE_HOST')) {
23b5a711 321 define('CIVICRM_DB_CACHE_HOST', 'localhost');
8d133ef2 322}
eb049397
DL
323
324/**
59e56021 325 * Change this if you are not using the standard port for your cache server
eb049397 326 */
8d133ef2 327if (!defined('CIVICRM_DB_CACHE_PORT')) {
23b5a711 328 define('CIVICRM_DB_CACHE_PORT', 11211 );
8d133ef2 329}
eb049397 330
59e56021
H
331/**
332 * Change this if your cache server requires a password (currently only works
333 * with Redis)
334 */
335if (!defined('CIVICRM_DB_CACHE_PASSWORD')) {
336 define('CIVICRM_DB_CACHE_PASSWORD', '' );
337}
338
eb049397
DL
339/**
340 * Items in cache will expire after the number of seconds specified here.
341 * Default value is 3600 (i.e., after an hour)
342 */
8d133ef2 343if (!defined('CIVICRM_DB_CACHE_TIMEOUT')) {
23b5a711 344 define('CIVICRM_DB_CACHE_TIMEOUT', 3600 );
8d133ef2 345}
eb049397
DL
346
347/**
59e56021 348 * If you are sharing the same cache instance with more than one CiviCRM
eb049397
DL
349 * database, you will need to set a different value for the following argument
350 * so that each copy of CiviCRM will not interfere with other copies. If you only
351 * have one copy of CiviCRM, you may leave this set to ''. A good value for
352 * this if you have two servers might be 'server1_' for the first server, and
353 * 'server2_' for the second server.
354 */
59e56021
H
355if (!defined('CIVICRM_DB_CACHE_PREFIX')) {
356 define('CIVICRM_DB_CACHE_PREFIX', '');
8d133ef2 357}
eb049397
DL
358
359/**
360 * If you have multilingual site and you are using the "inherit CMS language"
361 * configuration option, but wish to, for example, use fr_CA instead of the
362 * default fr_FR (for French), set one or more of the constants below to an
363 * appropriate regional value.
364 */
365// define('CIVICRM_LANGUAGE_MAPPING_FR', 'fr_CA');
366// define('CIVICRM_LANGUAGE_MAPPING_EN', 'en_CA');
367// define('CIVICRM_LANGUAGE_MAPPING_ES', 'es_MX');
368// define('CIVICRM_LANGUAGE_MAPPING_PT', 'pt_BR');
369// define('CIVICRM_LANGUAGE_MAPPING_ZH', 'zh_TW');
370
de67bc86
ML
371/**
372 * Native gettext improves performance of localized CiviCRM installations
373 * significantly. However, your host must enable the locale (language).
374 * On most GNU/Linux, Unix or MacOSX systems, you may view them with
375 * the command line by typing: "locale -a".
376 *
377 * On Debian or Ubuntu, you may reconfigure locales with:
378 * # dpkg-reconfigure locales
379 *
380 * For more information:
381 * http://wiki.civicrm.org/confluence/x/YABFBQ
382 */
8d133ef2 383// if (!defined('CIVICRM_GETTEXT_NATIVE')) {
de67bc86 384// define('CIVICRM_GETTEXT_NATIVE', 1);
8d133ef2 385// }
de67bc86 386
eb049397
DL
387/**
388 * Configure MySQL to throw more errors when encountering unusual SQL expressions.
389 *
390 * If undefined, the value is determined automatically. For CiviCRM tarballs, it defaults
391 * to FALSE; for SVN checkouts, it defaults to TRUE.
392 */
8d133ef2 393// if (!defined('CIVICRM_MYSQL_STRICT')) {
23b5a711 394// define('CIVICRM_MYSQL_STRICT', TRUE );
8d133ef2 395// }
eb049397 396
3b2c20b7
TO
397if (CIVICRM_UF === 'UnitTests') {
398 if (!defined('CIVICRM_CONTAINER_CACHE')) define('CIVICRM_CONTAINER_CACHE', 'auto');
399 if (!defined('CIVICRM_MYSQL_STRICT')) define('CIVICRM_MYSQL_STRICT', true);
400}
401
eb049397
DL
402/**
403 *
404 * Do not change anything below this line. Keep as is
405 *
406 */
407
408$include_path = '.' . PATH_SEPARATOR .
409 $civicrm_root . PATH_SEPARATOR .
410 $civicrm_root . DIRECTORY_SEPARATOR . 'packages' . PATH_SEPARATOR .
411 get_include_path( );
412if ( set_include_path( $include_path ) === false ) {
413 echo "Could not set the include path<p>";
414 exit( );
415}
416
8d133ef2 417if (!defined('CIVICRM_CLEANURL')) {
23b5a711
EM
418 if ( function_exists('variable_get') && variable_get('clean_url', '0') != '0') {
419 define('CIVICRM_CLEANURL', 1 );
420 }
421 else {
422 define('CIVICRM_CLEANURL', 0);
8d133ef2 423 }
eb049397
DL
424}
425
426// force PHP to auto-detect Mac line endings
427ini_set('auto_detect_line_endings', '1');
428
429// make sure the memory_limit is at least 64 MB
430$memLimitString = trim(ini_get('memory_limit'));
431$memLimitUnit = strtolower(substr($memLimitString, -1));
432$memLimit = (int) $memLimitString;
433switch ($memLimitUnit) {
434 case 'g': $memLimit *= 1024;
435 case 'm': $memLimit *= 1024;
436 case 'k': $memLimit *= 1024;
437}
438if ($memLimit >= 0 and $memLimit < 134217728) {
439 ini_set('memory_limit', '128M');
440}
441
442require_once 'CRM/Core/ClassLoader.php';
443CRM_Core_ClassLoader::singleton()->register();