Page MenuHomePhabricator

D14610.id35344.diff
No OneTemporary

D14610.id35344.diff

diff --git a/src/applications/config/module/PhabricatorConfigVersionsModule.php b/src/applications/config/module/PhabricatorConfigVersionsModule.php
--- a/src/applications/config/module/PhabricatorConfigVersionsModule.php
+++ b/src/applications/config/module/PhabricatorConfigVersionsModule.php
@@ -14,8 +14,7 @@
public function renderModuleStatus(AphrontRequest $request) {
$viewer = $request->getViewer();
-
- $versions = $this->loadVersions();
+ $versions = $this->loadVersions($viewer);
$version_property_list = id(new PHUIPropertyListView());
foreach ($versions as $version) {
@@ -39,26 +38,36 @@
return $object_box;
}
- private function loadVersions() {
+ private function loadVersions(PhabricatorUser $viewer) {
$specs = array(
array(
- 'name' => pht('Phabricator Version'),
- 'root' => 'phabricator',
+ 'title' => pht('Phabricator Version'),
+ 'lib' => 'phabricator',
),
array(
- 'name' => pht('Arcanist Version'),
- 'root' => 'arcanist',
+ 'title' => pht('Arcanist Version'),
+ 'lib' => 'arcanist',
),
array(
- 'name' => pht('libphutil Version'),
- 'root' => 'phutil',
+ 'title' => pht('libphutil Version'),
+ 'lib' => 'phutil',
),
);
+ $all_libraries = PhutilBootloader::getInstance()->getAllLibraries();
+ $other_libraries = array_diff($all_libraries, ipull($specs, 'lib'));
+ foreach ($other_libraries as $lib) {
+ $specs[] = array(
+ 'title' => $lib,
+ 'lib' => $lib,
+ );
+ }
+
$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 --'))
+ $root = dirname(phutil_get_library_root($spec['lib']));
+ $futures[$key] =
+ id(new ExecFuture('git log --format=%s -n 1 --', '%H %ct'))
->setCWD($root);
}
@@ -66,11 +75,12 @@
foreach ($futures as $key => $future) {
list($err, $stdout) = $future->resolve();
if (!$err) {
- $name = trim($stdout);
+ list($hash, $epoch) = explode(' ', $stdout);
+ $version = pht('%s (%s)', $hash, phabricator_date($epoch, $viewer));
} else {
- $name = pht('Unknown');
+ $version = pht('Unknown');
}
- $results[$key] = array($specs[$key]['name'], $name);
+ $results[$key] = array($specs[$key]['title'], $version);
}
return array_select_keys($results, array_keys($specs));

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 27, 4:32 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7685998
Default Alt Text
D14610.id35344.diff (2 KB)

Event Timeline