From ae9121f8e3c5d2b00a27d9d43884bd80c98c9bf6 Mon Sep 17 00:00:00 2001 From: Hans Idink Date: Thu, 17 Feb 2022 21:58:56 +0100 Subject: [PATCH] multisite config --- civicrm.config.php.backdrop | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/civicrm.config.php.backdrop b/civicrm.config.php.backdrop index 00b448a6..f3b7303b 100644 --- a/civicrm.config.php.backdrop +++ b/civicrm.config.php.backdrop @@ -83,18 +83,9 @@ function civicrm_conf_init() { } } - if (file_exists($confdir . DIRECTORY_SEPARATOR . 'civicrm.settings.php')) { - return $confdir; - } - - if (!file_exists($confdir) && !$skipConfigError) { - echo "Could not find valid configuration dir, best guess: $confdir

\n"; - exit(); - } - // Alias could be defined in sites/sites.php - if (file_exists($confdir . "/sites.php")) { - include $confdir . "/sites.php"; + if (file_exists($confdir . "/sites/sites.php")) { + include $confdir . "/sites/sites.php"; } else { $sites = array(); @@ -108,20 +99,31 @@ function civicrm_conf_init() { for ($i = count($uri) - 1; $i > 0; $i--) { for ($j = count($server); $j > 0; $j--) { $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); - if (file_exists("$confdir/$dir/civicrm.settings.php")) { - $conf = "$confdir/$dir"; + if (file_exists("$confdir/sites/$dir/civicrm.settings.php")) { + $conf = "$confdir/sites/$dir"; return $conf; } // check for alias - if (isset($sites[$dir]) && file_exists("$confdir/{$sites[$dir]}/civicrm.settings.php")) { - $conf = "$confdir/{$sites[$dir]}"; + if (isset($sites[$dir]) && file_exists("$confdir/sites/{$sites[$dir]}/civicrm.settings.php")) { + $conf = "$confdir/sites/{$sites[$dir]}"; return $conf; } } } // FIXME: problem spot for Drupal 5.1 config dir layout - $conf = "$confdir/default"; + $conf = "$confdir/sites/default"; + + if (file_exists($confdir . DIRECTORY_SEPARATOR . 'civicrm.settings.php')) { + return $confdir; + } + + if (!file_exists($confdir) && !$skipConfigError) { + echo "Could not find valid configuration dir, best guess: $confdir

\n"; + exit(); + } + + return $conf; }