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:
		@@ -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));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user