- Patch #14890: corrected the documentation of conf_init().

4.6.x
Dries Buytaert 2004-12-29 19:56:25 +00:00
parent 09c55017f6
commit bc9aeff7dd
1 changed files with 21 additions and 9 deletions

View File

@ -14,15 +14,27 @@ define('CACHE_TEMPORARY', -1);
*
* Try finding a matching configuration directory by stripping the
* website's hostname from left to right and pathname from right to
* left. If no configuration file is found, return a default value
* '$confdir/default'. Example for a ficticious site installed at
* http://www.drupal.org/test:
* 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'.
*
* 1. www.drupal.org.test
* 2. drupal.org.test
* 3. www.drupal.org
* 4. drupal.org
* 5. default
* Example for a ficticious 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 conf_init() {
static $conf = '';
@ -31,9 +43,9 @@ function conf_init() {
return $conf;
}
$confdir = 'sites';
$uri = explode('/', $_SERVER['PHP_SELF']);
$server = explode('.', $_SERVER['HTTP_HOST']);
$confdir = 'sites';
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));