Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.
includes/bootstrap.inc, строка 241
- 5
conf_path()
- 6
conf_path($require_settings = TRUE, $reset = FALSE)
Find the appropriate configuration directory.
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:8080/mysite/test/ the 'settings.php'
is searched in
the following directories:
1. $confdir
/8080.www.drupal.org.mysite.test
2. $confdir
/www.drupal.org.mysite.test
3. $confdir
/drupal.org.mysite.test
4. $confdir
/org.mysite.test
5. $confdir
/8080.www.drupal.org.mysite
6. $confdir
/www.drupal.org.mysite
7. $confdir
/drupal.org.mysite
8. $confdir
/org.mysite
9. $confdir
/8080.www.drupal.org
10. $confdir
/www.drupal.org
11. $confdir
/drupal.org
12. $confdir
/org
13. $confdir
/default
Параметры
$require_settings
Only configuration directories with an existing settings.php file
will be recognized. Defaults to TRUE
. During initial installation,
this is set to FALSE
so that Drupal can detect a matching directory,
then create a new settings.php file in it.
reset
Force a full search for matching directories even if one had been
found previously.
Возвращаемое значение
The path of the matching directory.
Find the appropriate configuration directory.
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:8080/mysite/test/ the 'settings.php' is searched in
the following directories:
1. $confdir/8080.www.drupal.org.mysite.test
2. $confdir/www.drupal.org.mysite.test
3. $confdir/drupal.org.mysite.test
4. $confdir/org.mysite.test
5. $confdir/8080.www.drupal.org.mysite
6. $confdir/www.drupal.org.mysite
7. $confdir/drupal.org.mysite
8. $confdir/org.mysite
9. $confdir/8080.www.drupal.org
10. $confdir/www.drupal.org
11. $confdir/drupal.org
12. $confdir/org
13. $confdir/default
Parameters
$require_settings
Only configuration directories with an existing settings.php file
will be recognized. Defaults to TRUE. During initial installation,
this is set to FALSE so that Drupal can detect a matching directory,
then create a new settings.php file in it.
reset
Force a full search for matching directories even if one had been
found previously.
Return value
The path of the matching directory.
▸ 10 функции вызывают conf_path()
▾ 10 функции вызывают conf_path()
- conf_init in includes/bootstrap.inc
- Загружает конфигурацию и устанавливает правильные базовый URL, куки и сессии
- drupal_get_filename in includes/bootstrap.inc
- Возвращает и опционально устанавливает имя файла системного элемента (модуль, тема, и т.д.). Имя файла, который существует, кеширован или получен из базы данных, возвращается если файл существует.
- drupal_rewrite_settings in includes/install.inc
- Read settings.php into a buffer line by line, changing values specified in
$settings array, then over-writing the old settings.php file.
- drupal_system_listing in includes/common.inc
- Return an array of system file objects.
- file_directory_path in includes/file.inc
- Определяет адрес по умолчанию для папки 'files' (папка хранения файлов, загруженных пользователями и т.п.)
- install_change_settings in ./install.php
- Configure and rewrite settings.php.
- install_check_requirements in ./install.php
- Check installation requirements and report any errors.
- install_tasks in ./install.php
- Tasks performed after the database is initialized.
- install_verify_settings in ./install.php
- Verify existing settings.php
- system_requirements in modules/system/system.install
- Test and report Drupal installation requirements.
Код
<?php
function conf_path($require_settings = TRUE, $reset = FALSE) {
static $conf = '';
if ($conf && !$reset) {
return $conf;
}
$confdir = 'sites';
$uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
$server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
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/settings.php") || (!$require_settings && file_exists("$confdir/$dir"))) {
$conf = "$confdir/$dir";
return $conf;
}
}
}
$conf = "$confdir/default";
return $conf;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии