Commit bc9aeff7 authored by Dries's avatar Dries
Browse files

- Patch #14890: corrected the documentation of conf_init().
parent 09c55017
......@@ -14,15 +14,27 @@
*
* 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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment