mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Versions Panel: Show extensions, dates
Summary: ref T9788 Test Plan: {F1008540} Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T9788 Differential Revision: https://secure.phabricator.com/D14610
This commit is contained in:
parent
065df01f65
commit
2fba7e66e7
1 changed files with 21 additions and 25 deletions
|
@ -14,13 +14,11 @@ final class PhabricatorConfigVersionsModule
|
|||
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) {
|
||||
list($name, $hash) = $version;
|
||||
$version_property_list->addProperty($name, $hash);
|
||||
foreach ($versions as $name => $version) {
|
||||
$version_property_list->addProperty($name, $version);
|
||||
}
|
||||
|
||||
$object_box = id(new PHUIObjectBoxView())
|
||||
|
@ -39,26 +37,23 @@ final class PhabricatorConfigVersionsModule
|
|||
return $object_box;
|
||||
}
|
||||
|
||||
private function loadVersions() {
|
||||
private function loadVersions(PhabricatorUser $viewer) {
|
||||
$specs = array(
|
||||
array(
|
||||
'name' => pht('Phabricator Version'),
|
||||
'root' => 'phabricator',
|
||||
),
|
||||
array(
|
||||
'name' => pht('Arcanist Version'),
|
||||
'root' => 'arcanist',
|
||||
),
|
||||
array(
|
||||
'name' => pht('libphutil Version'),
|
||||
'root' => 'phutil',
|
||||
),
|
||||
'phabricator',
|
||||
'arcanist',
|
||||
'phutil',
|
||||
);
|
||||
|
||||
$all_libraries = PhutilBootloader::getInstance()->getAllLibraries();
|
||||
$other_libraries = array_diff($all_libraries, ipull($specs, 'lib'));
|
||||
$specs = $specs + $other_libraries;
|
||||
|
||||
|
||||
$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 --'))
|
||||
foreach ($specs as $lib) {
|
||||
$root = dirname(phutil_get_library_root($lib));
|
||||
$futures[$lib] =
|
||||
id(new ExecFuture('git log --format=%s -n 1 --', '%H %ct'))
|
||||
->setCWD($root);
|
||||
}
|
||||
|
||||
|
@ -66,14 +61,15 @@ final class PhabricatorConfigVersionsModule
|
|||
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] = $version;
|
||||
}
|
||||
|
||||
return array_select_keys($results, array_keys($specs));
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue