From 1582bb54f649f59057223a0f51614665bc9e3505 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 24 Oct 2015 08:13:22 -0700 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 2 + .../PhabricatorConfigAllController.php | 59 -------------- .../PhabricatorConfigVersionsModule.php | 79 +++++++++++++++++++ src/docs/contributor/bug_reports.diviner | 11 +-- 4 files changed, 87 insertions(+), 64 deletions(-) create mode 100644 src/applications/config/module/PhabricatorConfigVersionsModule.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d00b3a377d..41ae622d45 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/config/controller/PhabricatorConfigAllController.php b/src/applications/config/controller/PhabricatorConfigAllController.php index 17bf65fd7b..d805168eb1 100644 --- a/src/applications/config/controller/PhabricatorConfigAllController.php +++ b/src/applications/config/controller/PhabricatorConfigAllController.php @@ -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)); - } - - } diff --git a/src/applications/config/module/PhabricatorConfigVersionsModule.php b/src/applications/config/module/PhabricatorConfigVersionsModule.php new file mode 100644 index 0000000000..b3240aec51 --- /dev/null +++ b/src/applications/config/module/PhabricatorConfigVersionsModule.php @@ -0,0 +1,79 @@ +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)); + } + +} diff --git a/src/docs/contributor/bug_reports.diviner b/src/docs/contributor/bug_reports.diviner index 0ad3635d87..46ac466d83 100644 --- a/src/docs/contributor/bug_reports.diviner +++ b/src/docs/contributor/bug_reports.diviner @@ -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