forked from civicrm/civicrm-drupal-8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
civicrm.config.php.drupal
64 lines (55 loc) · 1.65 KB
/
civicrm.config.php.drupal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* This function has been copied from DRUPAL_ROOT/includes/bootstrap.inc
*/
/**
* Locate the appropriate configuration file.
*
* Try finding a matching configuration directory by stripping the
* website's hostname from left to right and pathname from right to
* left. The first configuration file found will be used, the
* remaining will ignored. If no configuration file is found,
* return a default value '$confdir/default'.
*
* Example for a fictitious site installed at
* http://www.drupal.org/mysite/test/ the 'settings.php' is
* searched in the following directories:
*
* 1. $confdir/www.drupal.org.mysite.test
* 2. $confdir/drupal.org.mysite.test
* 3. $confdir/org.mysite.test
*
* 4. $confdir/www.drupal.org.mysite
* 5. $confdir/drupal.org.mysite
* 6. $confdir/org.mysite
*
* 7. $confdir/www.drupal.org
* 8. $confdir/drupal.org
* 9. $confdir/org
*
* 10. $confdir/default
*
*/
function civicrm_conf_init() {
global $skipConfigError;
static $conf = '';
if ($conf) {
return $conf;
}
// There is much more complex stuff in d7 - but lets just handle sites/default for now....
$candidates[] = "../../sites/default";
$candidates[] = "../../../sites/default";
foreach ($candidates as $candidate) {
if (is_dir($candidate)) {
return $candidate;
}
}
throw new Exception(ts('site directory not found'));
}
$settingsFile = civicrm_conf_init() . '/civicrm.settings.php';
define('CIVICRM_SETTINGS_PATH', $settingsFile);
$error = @include_once( $settingsFile );
if ( $error == false ) {
echo "Could not load the settings file at: {$settingsFile}\n";
exit( );
}