2013-01-16 20:10:41 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorConfigAllController
|
|
|
|
extends PhabricatorConfigController {
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
2013-04-13 18:31:24 +02:00
|
|
|
$db_values = id(new PhabricatorConfigEntry())
|
|
|
|
->loadAllWhere('namespace = %s', 'default');
|
|
|
|
$db_values = mpull($db_values, null, 'getConfigKey');
|
|
|
|
|
2013-01-16 20:10:41 +01:00
|
|
|
$rows = array();
|
|
|
|
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
|
2013-01-16 20:39:13 +01:00
|
|
|
ksort($options);
|
2013-01-16 20:10:41 +01:00
|
|
|
foreach ($options as $option) {
|
|
|
|
$key = $option->getKey();
|
|
|
|
|
|
|
|
if ($option->getMasked()) {
|
2013-02-13 23:50:15 +01:00
|
|
|
$value = phutil_tag('em', array(), pht('Masked'));
|
2013-01-16 20:10:41 +01:00
|
|
|
} else if ($option->getHidden()) {
|
2013-02-13 23:50:15 +01:00
|
|
|
$value = phutil_tag('em', array(), pht('Hidden'));
|
2013-01-16 20:10:41 +01:00
|
|
|
} else {
|
|
|
|
$value = PhabricatorEnv::getEnvConfig($key);
|
|
|
|
$value = PhabricatorConfigJSON::prettyPrintJSON($value);
|
|
|
|
}
|
|
|
|
|
2013-04-13 18:31:24 +02:00
|
|
|
$db_value = idx($db_values, $key);
|
2013-01-16 20:10:41 +01:00
|
|
|
$rows[] = array(
|
2013-01-18 03:43:35 +01:00
|
|
|
phutil_tag(
|
2013-01-16 20:10:41 +01:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $this->getApplicationURI('edit/'.$key.'/'),
|
|
|
|
),
|
2013-01-18 03:43:35 +01:00
|
|
|
$key),
|
2013-01-16 20:10:41 +01:00
|
|
|
$value,
|
2013-04-13 18:31:24 +02:00
|
|
|
$db_value && !$db_value->getIsDeleted() ? pht('Customized') : '',
|
2013-01-16 20:10:41 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
$table = id(new AphrontTableView($rows))
|
|
|
|
->setDeviceReadyTable(true)
|
|
|
|
->setColumnClasses(
|
|
|
|
array(
|
|
|
|
'',
|
|
|
|
'wide',
|
|
|
|
))
|
|
|
|
->setHeaders(
|
|
|
|
array(
|
|
|
|
pht('Key'),
|
|
|
|
pht('Value'),
|
2013-04-13 18:31:24 +02:00
|
|
|
pht('Customized'),
|
2013-01-16 20:10:41 +01:00
|
|
|
));
|
|
|
|
|
|
|
|
$title = pht('Current Settings');
|
|
|
|
|
|
|
|
$crumbs = $this
|
|
|
|
->buildApplicationCrumbs()
|
|
|
|
->addCrumb(
|
|
|
|
id(new PhabricatorCrumbView())
|
|
|
|
->setName($title));
|
|
|
|
|
2013-01-19 03:08:06 +01:00
|
|
|
$panel = new AphrontPanelView();
|
|
|
|
$panel->appendChild($table);
|
|
|
|
$panel->setNoBackground();
|
|
|
|
|
2013-07-18 21:41:03 +02:00
|
|
|
$versions = $this->loadVersions();
|
|
|
|
|
2013-01-19 19:24:46 +01:00
|
|
|
$version_property_list = id(new PhabricatorPropertyListView());
|
2013-07-18 21:41:03 +02:00
|
|
|
foreach ($versions as $version) {
|
|
|
|
list($name, $hash) = $version;
|
|
|
|
$version_property_list->addProperty($name, $hash);
|
|
|
|
}
|
2013-01-29 20:01:47 +01:00
|
|
|
|
2013-09-29 00:55:38 +02:00
|
|
|
$object_box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText(pht('Current Settings'))
|
Provide more structure to PHUIObjectBoxView
Summary:
Three changes here.
- Add `setActionList()`, and use that to set the action list.
- Add `setPropertyList()`, and use that to set the property list.
These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.
- Replace `addContent()` with `appendChild()`.
This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.
Test Plan:
- Viewed "All Config".
- Viewed a countdown.
- Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
- Viewed Diffusion (browse, change, history, repository, lint).
- Viewed Drydock (resource, lease).
- Viewed Files.
- Viewed Herald.
- Viewed Legalpad.
- Viewed macro (edit, edit audio, view).
- Viewed Maniphest.
- Viewed Applications.
- Viewed Paste.
- Viewed People.
- Viewed Phulux.
- Viewed Pholio.
- Viewed Phame (blog, post).
- Viewed Phortune (account, product).
- Viewed Ponder (questions, answers, comments).
- Viewed Releeph.
- Viewed Projects.
- Viewed Slowvote.
NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?
NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.
Reviewers: chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D7174
2013-09-30 18:36:04 +02:00
|
|
|
->setPropertyList($version_property_list);
|
2013-09-29 00:55:38 +02:00
|
|
|
|
2013-07-18 21:41:03 +02:00
|
|
|
$phabricator_root = dirname(phutil_get_library_root('phabricator'));
|
2013-01-20 02:07:18 +01:00
|
|
|
$version_path = $phabricator_root.'/conf/local/VERSION';
|
|
|
|
if (Filesystem::pathExists($version_path)) {
|
|
|
|
$version_from_file = Filesystem::readFile($version_path);
|
2013-01-29 20:01:47 +01:00
|
|
|
$version_property_list->addProperty(
|
|
|
|
pht('Local Version'),
|
|
|
|
$version_from_file);
|
2013-01-20 02:07:18 +01:00
|
|
|
}
|
2013-01-19 19:24:46 +01:00
|
|
|
|
2013-01-16 20:10:41 +01:00
|
|
|
$nav = $this->buildSideNavView();
|
|
|
|
$nav->selectFilter('all/');
|
|
|
|
$nav->setCrumbs($crumbs);
|
2013-09-29 00:55:38 +02:00
|
|
|
$nav->appendChild($object_box);
|
2013-01-19 03:08:06 +01:00
|
|
|
$nav->appendChild($panel);
|
2013-01-16 20:10:41 +01:00
|
|
|
|
2013-01-19 19:24:46 +01:00
|
|
|
|
2013-01-16 20:10:41 +01:00
|
|
|
return $this->buildApplicationPage(
|
|
|
|
$nav,
|
|
|
|
array(
|
|
|
|
'title' => $title,
|
|
|
|
'device' => true,
|
2013-02-19 22:33:10 +01:00
|
|
|
));
|
2013-01-16 20:10:41 +01:00
|
|
|
}
|
|
|
|
|
2013-07-18 21:41:03 +02:00
|
|
|
private function loadVersions() {
|
|
|
|
$specs = array(
|
|
|
|
array(
|
|
|
|
'name' => pht('Phabricator Version'),
|
|
|
|
'root' => 'phabricator',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => pht('Arcanist Version'),
|
|
|
|
'root' => 'arcanist',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => pht('libphutil Version'),
|
|
|
|
'root' => 'phutil',
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
$futures = array();
|
|
|
|
foreach ($specs as $key => $spec) {
|
|
|
|
$root = dirname(phutil_get_library_root($spec['root']));
|
|
|
|
$futures[$key] = id(new ExecFuture('git log --format=%%H -n 1 --'))
|
|
|
|
->setCWD($root);
|
|
|
|
}
|
|
|
|
|
|
|
|
$results = array();
|
|
|
|
foreach ($futures as $key => $future) {
|
|
|
|
list($err, $stdout) = $future->resolve();
|
|
|
|
if (!$err) {
|
|
|
|
$name = trim($stdout);
|
|
|
|
} else {
|
|
|
|
$name = pht('Unknown');
|
|
|
|
}
|
|
|
|
$results[$key] = array($specs[$key]['name'], $name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return array_select_keys($results, array_keys($specs));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-01-16 20:10:41 +01:00
|
|
|
}
|