mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Move version numbers to a dedicated "Versions" panel
Summary: Currently, Version numbers are sort of randomly shown on "All Settings" beacuse we didn't have any better place to put them. Now that we have modules, expose them as a config module. Test Plan: {F906426} Grepped for "all settings" to look for other references to the old location, but didn't get any relevant hits. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D14327
This commit is contained in:
parent
32dc62955a
commit
1582bb54f6
4 changed files with 87 additions and 64 deletions
|
@ -1914,6 +1914,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorConfigTransaction' => 'applications/config/storage/PhabricatorConfigTransaction.php',
|
||||
'PhabricatorConfigTransactionQuery' => 'applications/config/query/PhabricatorConfigTransactionQuery.php',
|
||||
'PhabricatorConfigValidationException' => 'applications/config/exception/PhabricatorConfigValidationException.php',
|
||||
'PhabricatorConfigVersionsModule' => 'applications/config/module/PhabricatorConfigVersionsModule.php',
|
||||
'PhabricatorConfigWelcomeController' => 'applications/config/controller/PhabricatorConfigWelcomeController.php',
|
||||
'PhabricatorConpherenceApplication' => 'applications/conpherence/application/PhabricatorConpherenceApplication.php',
|
||||
'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php',
|
||||
|
@ -5893,6 +5894,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorConfigTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'PhabricatorConfigTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
'PhabricatorConfigValidationException' => 'Exception',
|
||||
'PhabricatorConfigVersionsModule' => 'PhabricatorConfigModule',
|
||||
'PhabricatorConfigWelcomeController' => 'PhabricatorConfigController',
|
||||
'PhabricatorConpherenceApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
|
||||
|
|
|
@ -58,31 +58,10 @@ final class PhabricatorConfigAllController
|
|||
$panel->setHeaderText(pht('Current Settings'));
|
||||
$panel->setTable($table);
|
||||
|
||||
$versions = $this->loadVersions();
|
||||
|
||||
$version_property_list = id(new PHUIPropertyListView());
|
||||
foreach ($versions as $version) {
|
||||
list($name, $hash) = $version;
|
||||
$version_property_list->addProperty($name, $hash);
|
||||
}
|
||||
|
||||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Current Version'))
|
||||
->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);
|
||||
}
|
||||
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('all/');
|
||||
$nav->setCrumbs($crumbs);
|
||||
$nav->appendChild($object_box);
|
||||
$nav->appendChild($panel);
|
||||
|
||||
|
||||
|
@ -93,42 +72,4 @@ 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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<?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();
|
||||
|
||||
$version_property_list = id(new PHUIPropertyListView());
|
||||
foreach ($versions as $version) {
|
||||
list($name, $hash) = $version;
|
||||
$version_property_list->addProperty($name, $hash);
|
||||
}
|
||||
|
||||
$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() {
|
||||
$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));
|
||||
}
|
||||
|
||||
}
|
|
@ -69,11 +69,12 @@ To update Phabricator, use a script like the one described in
|
|||
@{article:Upgrading Phabricator}.
|
||||
|
||||
**If you can not update** for some reason, please include the version of
|
||||
Phabricator you are running in your report. The version is just the Git hash
|
||||
of your local HEAD. You can find the version by running `git show` in
|
||||
`phabricator/` and copy/pasting the first line of output, or by browsing to
|
||||
{nav Config > All Settings} in the web UI and copy/pasting the information
|
||||
at the top.
|
||||
Phabricator you are running when you file a report. You can find the version in
|
||||
{nav Config > Versions} in the web UI.
|
||||
|
||||
(The version is just the Git hash of your local HEAD, so you can also find it
|
||||
by running `git show` in `phabricator/` and looking at the first line of
|
||||
output.)
|
||||
|
||||
|
||||
Supported Issues
|
||||
|
|
Loading…
Reference in a new issue