3 function phabricator_read_config_file($original_config) {
4 $root = dirname(dirname(__FILE__
));
6 // Accept either "myconfig" (preferred) or "myconfig.conf.php".
7 $config = preg_replace('/\.conf\.php$/', '', $original_config);
8 $full_config_path = $root.'/conf/'.$config.'.conf.php';
10 if (!Filesystem
::pathExists($full_config_path)) {
11 // These are very old configuration files which we used to ship with
12 // by default. File based configuration was de-emphasized once web-based
13 // configuration was built. The actual files were removed to reduce
14 // user confusion over how to configure Phabricator.
22 'phabricator.developer-mode' => true,
23 'darkconsole.enabled' => true,
27 $files = id(new FileFinder($root.'/conf/'))
29 ->withSuffix('conf.php')
30 ->withFollowSymlinks(true)
33 foreach ($files as $key => $file) {
34 $file = trim($file, './');
35 $files[$key] = preg_replace('/\.conf\.php$/', '', $file);
37 $files = ' '.implode("\n ", $files);
41 "CONFIGURATION ERROR\n".
42 "Config file '%s' does not exist. Valid config files are:\n\n%s",
47 // Make sure config file errors are reported.
48 $old_error_level = error_reporting(E_ALL | E_STRICT
);
49 $old_display_errors = ini_get('display_errors');
50 ini_set('display_errors', 1);
53 $conf = include $full_config_path;
54 $errors = ob_get_clean();
56 error_reporting($old_error_level);
57 ini_set('display_errors', $old_display_errors);
59 if ($conf === false) {
62 "Failed to read config file '%s': %s",