mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-21 11:09:02 +01:00
Add arcanist and libphutil versions to /config/all/
Summary: Fixes T3453. Makes it easier for me to get version info when supporting users, since they can copy/paste from the web UI instead of running a bunch of `git` commands. Test Plan: {F50749} Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3453 Differential Revision: https://secure.phabricator.com/D6491
This commit is contained in:
parent
ab5ee5d193
commit
0b1b988107
1 changed files with 46 additions and 13 deletions
|
@ -64,20 +64,15 @@ final class PhabricatorConfigAllController
|
|||
$panel->appendChild($table);
|
||||
$panel->setNoBackground();
|
||||
|
||||
$phabricator_root = dirname(phutil_get_library_root('phabricator'));
|
||||
$future = id(new ExecFuture('git log --format=%%H -n 1 --'))
|
||||
->setCWD($phabricator_root);
|
||||
list($err, $stdout) = $future->resolve();
|
||||
if (!$err) {
|
||||
$display_version = trim($stdout);
|
||||
} else {
|
||||
$display_version = pht('Unknown');
|
||||
}
|
||||
$version_property_list = id(new PhabricatorPropertyListView());
|
||||
$version_property_list->addProperty(
|
||||
pht('Version'),
|
||||
$display_version);
|
||||
$versions = $this->loadVersions();
|
||||
|
||||
$version_property_list = id(new PhabricatorPropertyListView());
|
||||
foreach ($versions as $version) {
|
||||
list($name, $hash) = $version;
|
||||
$version_property_list->addProperty($name, $hash);
|
||||
}
|
||||
|
||||
$phabricator_root = dirname(phutil_get_library_root('phabricator'));
|
||||
$version_path = $phabricator_root.'/conf/local/VERSION';
|
||||
if (Filesystem::pathExists($version_path)) {
|
||||
$version_from_file = Filesystem::readFile($version_path);
|
||||
|
@ -102,4 +97,42 @@ final class PhabricatorConfigAllController
|
|||
));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue