Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/config/module/PhabricatorConfigVersionsModule.php b/src/applications/config/module/PhabricatorConfigVersionsModule.php
index b3240aec51..611c332eb0 100644
--- a/src/applications/config/module/PhabricatorConfigVersionsModule.php
+++ b/src/applications/config/module/PhabricatorConfigVersionsModule.php
@@ -1,79 +1,75 @@
<?php
final class PhabricatorConfigVersionsModule
extends PhabricatorConfigModule {
public function getModuleKey() {
return 'versions';
}
public function getModuleName() {
return pht('Versions');
}
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())
->setHeaderText(pht('Current Versions'))
->addPropertyList($version_property_list);
$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);
$version_property_list->addProperty(
pht('Local Version'),
$version_from_file);
}
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);
}
$results = array();
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;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Aug 14, 5:18 AM (2 d, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
202190
Default Alt Text
(3 KB)

Event Timeline