Skip to content

Commit ff526e1

Browse files
author
Erland Wiencke
committed
Fixed the config ignore pattern
1 parent 007e7a9 commit ff526e1

File tree

4 files changed

+67
-1
lines changed

4 files changed

+67
-1
lines changed

conf/__init_conf__.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
function phabricator_read_config_file($original_config) {
4+
5+
$root = dirname(dirname(__FILE__));
6+
7+
// Accept either "myconfig" (preferred) or "myconfig.conf.php".
8+
$config = preg_replace('/\.conf\.php$/', '', $original_config);
9+
$full_config_path = $root.'/conf/'.$config.'.conf.php';
10+
11+
if (!Filesystem::pathExists($full_config_path)) {
12+
13+
// These are very old configuration files which we used to ship with
14+
// by default. File based configuration was de-emphasized once web-based
15+
// configuration was built. The actual files were removed to reduce
16+
// user confusion over how to configure Phabricator.
17+
18+
switch ($config) {
19+
case 'default':
20+
case 'production':
21+
return array();
22+
case 'development':
23+
return array(
24+
'phabricator.developer-mode' => true,
25+
'darkconsole.enabled' => true,
26+
'celerity.minify' => false,
27+
);
28+
}
29+
30+
$files = id(new FileFinder($root.'/conf/'))
31+
->withType('f')
32+
->withSuffix('conf.php')
33+
->withFollowSymlinks(true)
34+
->find();
35+
36+
foreach ($files as $key => $file) {
37+
$file = trim($file, './');
38+
$files[$key] = preg_replace('/\.conf\.php$/', '', $file);
39+
}
40+
$files = " ".implode("\n ", $files);
41+
42+
throw new Exception(
43+
"CONFIGURATION ERROR\n".
44+
"Config file '{$original_config}' does not exist. Valid config files ".
45+
"are:\n\n".$files);
46+
}
47+
48+
// Make sure config file errors are reported.
49+
$old_error_level = error_reporting(E_ALL | E_STRICT);
50+
$old_display_errors = ini_get('display_errors');
51+
ini_set('display_errors', 1);
52+
53+
ob_start();
54+
$conf = include $full_config_path;
55+
$errors = ob_get_clean();
56+
57+
error_reporting($old_error_level);
58+
ini_set('display_errors', $old_display_errors);
59+
60+
if ($conf === false) {
61+
throw new Exception("Failed to read config file '{$config}': {$errors}");
62+
}
63+
64+
return $conf;
65+
}

conf/keys/.keep

Whitespace-only changes.

conf/local/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Run bin/config to work with this directory.

deploy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
set('repository', '[email protected]:vgno/phabricator.git');
1313
set('shared_dirs', ['conf']);
1414

15-
1615
task('deploy', [
1716
'deploy:start',
1817
'deploy:prepare',
1918
'deploy:update_code',
2019
'deploy:symlink',
20+
'deploy:shared',
2121
'cleanup',
2222
'deploy:end'
2323
])->desc('Deploy your project');

0 commit comments

Comments
 (0)