1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30:55 +01:00

Improve the DarkConsole "config" plugin to list libraries and source locations.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-24 14:50:50 -08:00
parent af4ab07f46
commit dbb4653be3
2 changed files with 38 additions and 6 deletions

View file

@ -27,19 +27,50 @@ class DarkConsoleConfigPlugin extends DarkConsolePlugin {
} }
public function generateData() { public function generateData() {
return PhabricatorEnv::getAllConfigKeys(); $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() { public function render() {
$data = $this->getData(); $data = $this->getData();
ksort($data);
$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 = PhabricatorEnv::getEnvConfig('darkconsole.config-mask');
$mask = array_fill_keys($mask, true); $mask = array_fill_keys($mask, true);
$rows = array(); $rows = array();
foreach ($data as $key => $value) { foreach ($config_data as $key => $value) {
if (empty($mask[$key])) { if (empty($mask[$key])) {
$display_value = is_array($value) ? json_encode($value) : $value; $display_value = is_array($value) ? json_encode($value) : $value;
$display_value = phutil_escape_html($display_value); $display_value = phutil_escape_html($display_value);
@ -64,6 +95,6 @@ class DarkConsoleConfigPlugin extends DarkConsolePlugin {
'wide wrap', 'wide wrap',
)); ));
return $table->render(); return $lib_table->render().$table->render();
} }
} }

View file

@ -11,6 +11,7 @@ phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phabricator', 'view/control/table'); phutil_require_module('phabricator', 'view/control/table');
phutil_require_module('phutil', 'markup'); phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'moduleutils');
phutil_require_source('DarkConsoleConfigPlugin.php'); phutil_require_source('DarkConsoleConfigPlugin.php');