~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to phabricator/conf/__init_conf__.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2015-06-13 10:52:10 UTC
  • mfrom: (0.30.1) (0.29.1) (0.17.4) (2.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20150613105210-5uirr7tvnk0n6e6y
Tags: 0~git20150613-1
* New snapshot release (closes: #787805)
* fixed typo in logrotate script (closes: #787645)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
 
3
3
function phabricator_read_config_file($original_config) {
4
 
 
5
4
  $root = dirname(dirname(__FILE__));
6
5
 
7
6
  // Accept either "myconfig" (preferred) or "myconfig.conf.php".
9
8
  $full_config_path = $root.'/conf/'.$config.'.conf.php';
10
9
 
11
10
  if (!Filesystem::pathExists($full_config_path)) {
12
 
 
13
11
    // These are very old configuration files which we used to ship with
14
12
    // by default. File based configuration was de-emphasized once web-based
15
13
    // configuration was built. The actual files were removed to reduce
37
35
      $file = trim($file, './');
38
36
      $files[$key] = preg_replace('/\.conf\.php$/', '', $file);
39
37
    }
40
 
    $files = "    ".implode("\n    ", $files);
 
38
    $files = '    '.implode("\n    ", $files);
41
39
 
42
40
    throw new Exception(
43
 
      "CONFIGURATION ERROR\n".
44
 
      "Config file '{$original_config}' does not exist. Valid config files ".
45
 
      "are:\n\n".$files);
 
41
      pht(
 
42
        "CONFIGURATION ERROR\n".
 
43
        "Config file '%s' does not exist. Valid config files are:\n\n%s",
 
44
        $original_config,
 
45
        $files));
46
46
  }
47
47
 
48
48
  // Make sure config file errors are reported.
58
58
  ini_set('display_errors', $old_display_errors);
59
59
 
60
60
  if ($conf === false) {
61
 
    throw new Exception("Failed to read config file '{$config}': {$errors}");
 
61
    throw new Exception(
 
62
      pht(
 
63
        "Failed to read config file '%s': %s",
 
64
        $config,
 
65
        $errors));
62
66
  }
63
67
 
64
68
  return $conf;