Summary: This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory). We are removing the headers for these reasons: - It wastes space in editors, less code is visible in editor upon opening a file. - It brings noise to diff of the first change of any file every year. - It confuses Git file copy detection when creating small files. - We don't have an explicit license header in other files (JS, CSS, images, documentation). - Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new. This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook). Test Plan: Verified that the license survived only in LICENSE file and that it didn't modify externals. Reviewers: epriestley, davidrecordon Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2035 Differential Revision: https://secure.phabricator.com/D3886
98 lines
2.3 KiB
PHP
98 lines
2.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group console
|
|
*/
|
|
final class DarkConsoleConfigPlugin extends DarkConsolePlugin {
|
|
|
|
public function getName() {
|
|
return 'Config';
|
|
}
|
|
|
|
public function getDescription() {
|
|
return 'Information about Phabricator configuration';
|
|
}
|
|
|
|
public function generateData() {
|
|
$lib_data = array();
|
|
foreach (PhutilBootloader::getInstance()->getAllLibraries() as $lib) {
|
|
$lib_data[$lib] = phutil_get_library_root($lib);
|
|
}
|
|
return array(
|
|
'config' => PhabricatorEnv::getAllConfigKeys(),
|
|
'libraries' => $lib_data,
|
|
);
|
|
}
|
|
|
|
public function render() {
|
|
|
|
$data = $this->getData();
|
|
|
|
$lib_data = $data['libraries'];
|
|
|
|
$lib_rows = array();
|
|
foreach ($lib_data as $key => $value) {
|
|
$lib_rows[] = array(
|
|
phutil_escape_html($key),
|
|
phutil_escape_html($value),
|
|
);
|
|
}
|
|
|
|
$lib_table = new AphrontTableView($lib_rows);
|
|
$lib_table->setHeaders(
|
|
array(
|
|
'Library',
|
|
'Loaded From',
|
|
));
|
|
$lib_table->setColumnClasses(
|
|
array(
|
|
'header',
|
|
'wide wrap',
|
|
));
|
|
|
|
$config_data = $data['config'];
|
|
ksort($config_data);
|
|
|
|
$mask = PhabricatorEnv::getEnvConfig('darkconsole.config-mask');
|
|
$mask = array_fill_keys($mask, true);
|
|
|
|
foreach ($mask as $masked_key => $ignored) {
|
|
if (!PhabricatorEnv::envConfigExists($masked_key)) {
|
|
throw new Exception(
|
|
"Configuration 'darkconsole.config-mask' masks unknown ".
|
|
"configuration key '".$masked_key."'. If this key has been ".
|
|
"renamed, you might be accidentally exposing information which you ".
|
|
"don't intend to.");
|
|
}
|
|
}
|
|
|
|
$rows = array();
|
|
foreach ($config_data as $key => $value) {
|
|
if (empty($mask[$key])) {
|
|
$display_value = is_array($value) ? json_encode($value) : $value;
|
|
$display_value = phutil_escape_html($display_value);
|
|
} else {
|
|
$display_value = phutil_escape_html('<Masked>');
|
|
}
|
|
$rows[] = array(
|
|
phutil_escape_html($key),
|
|
$display_value,
|
|
);
|
|
}
|
|
|
|
$table = new AphrontTableView($rows);
|
|
$table->setHeaders(
|
|
array(
|
|
'Key',
|
|
'Value',
|
|
));
|
|
$table->setColumnClasses(
|
|
array(
|
|
'header',
|
|
'wide wrap',
|
|
));
|
|
|
|
return $lib_table->render().$table->render();
|
|
}
|
|
}
|