@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a debug view of the "Affected Path" index to Differential

Summary:
Ref T13639. The "Affected Path" table is currently hard to inspect: there's no UI, and using MySQL just gives you a bunch of IDs.

Add a simple UI and a debug-mode link to it.

Test Plan:
{F8539098}

{F8539099}

Maniphest Tasks: T13639

Differential Revision: https://secure.phabricator.com/D21615

+141
+2
src/__phutil_library_map__.php
··· 613 613 'DifferentialRevisionAcceptTransaction' => 'applications/differential/xaction/DifferentialRevisionAcceptTransaction.php', 614 614 'DifferentialRevisionActionTransaction' => 'applications/differential/xaction/DifferentialRevisionActionTransaction.php', 615 615 'DifferentialRevisionAffectedFilesHeraldField' => 'applications/differential/herald/DifferentialRevisionAffectedFilesHeraldField.php', 616 + 'DifferentialRevisionAffectedPathsController' => 'applications/differential/controller/DifferentialRevisionAffectedPathsController.php', 616 617 'DifferentialRevisionAuthorHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorHeraldField.php', 617 618 'DifferentialRevisionAuthorPackagesHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorPackagesHeraldField.php', 618 619 'DifferentialRevisionAuthorProjectsHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php', ··· 6733 6734 'DifferentialRevisionAcceptTransaction' => 'DifferentialRevisionReviewTransaction', 6734 6735 'DifferentialRevisionActionTransaction' => 'DifferentialRevisionTransactionType', 6735 6736 'DifferentialRevisionAffectedFilesHeraldField' => 'DifferentialRevisionHeraldField', 6737 + 'DifferentialRevisionAffectedPathsController' => 'DifferentialController', 6736 6738 'DifferentialRevisionAuthorHeraldField' => 'DifferentialRevisionHeraldField', 6737 6739 'DifferentialRevisionAuthorPackagesHeraldField' => 'DifferentialRevisionHeraldField', 6738 6740 'DifferentialRevisionAuthorProjectsHeraldField' => 'DifferentialRevisionHeraldField',
+2
src/applications/differential/application/PhabricatorDifferentialApplication.php
··· 74 74 => 'DifferentialRevisionOperationController', 75 75 'inlines/(?P<id>[1-9]\d*)/' 76 76 => 'DifferentialRevisionInlinesController', 77 + 'paths/(?P<id>[1-9]\d*)/' 78 + => 'DifferentialRevisionAffectedPathsController', 77 79 ), 78 80 'comment/' => array( 79 81 'inline/' => array(
+127
src/applications/differential/controller/DifferentialRevisionAffectedPathsController.php
··· 1 + <?php 2 + 3 + final class DifferentialRevisionAffectedPathsController 4 + extends DifferentialController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $this->getViewer(); 8 + $id = $request->getURIData('id'); 9 + 10 + $revision = id(new DifferentialRevisionQuery()) 11 + ->withIDs(array($id)) 12 + ->setViewer($viewer) 13 + ->executeOne(); 14 + if (!$revision) { 15 + return new Aphront404Response(); 16 + } 17 + 18 + $table = new DifferentialAffectedPath(); 19 + $conn = $table->establishConnection('r'); 20 + 21 + $paths = queryfx_all( 22 + $conn, 23 + 'SELECT * FROM %R WHERE revisionID = %d', 24 + $table, 25 + $revision->getID()); 26 + 27 + $repository_ids = array(); 28 + $path_ids = array(); 29 + 30 + foreach ($paths as $path) { 31 + $repository_id = $path['repositoryID']; 32 + $path_id = $path['pathID']; 33 + 34 + $repository_ids[] = $repository_id; 35 + $path_ids[] = $path_id; 36 + } 37 + 38 + $repository_ids = array_fuse($repository_ids); 39 + 40 + if ($repository_ids) { 41 + $repositories = id(new PhabricatorRepositoryQuery()) 42 + ->setViewer($viewer) 43 + ->withIDs($repository_ids) 44 + ->execute(); 45 + $repositories = mpull($repositories, null, 'getID'); 46 + } else { 47 + $repositories = array(); 48 + } 49 + 50 + $handles = $viewer->loadHandles(mpull($repositories, 'getPHID')); 51 + 52 + $path_ids = array_fuse($path_ids); 53 + if ($path_ids) { 54 + $path_names = id(new DiffusionPathQuery()) 55 + ->withPathIDs($path_ids) 56 + ->execute(); 57 + } else { 58 + $path_names = array(); 59 + } 60 + 61 + $rows = array(); 62 + foreach ($paths as $path) { 63 + $repository_id = $path['repositoryID']; 64 + $path_id = $path['pathID']; 65 + 66 + $repository = idx($repositories, $repository_id); 67 + if ($repository) { 68 + $repository_phid = $repository->getPHID(); 69 + $repository_link = $handles[$repository_phid]->renderLink(); 70 + } else { 71 + $repository_link = null; 72 + } 73 + 74 + $path_name = idx($path_names, $path_id); 75 + if ($path_name !== null) { 76 + $path_view = $path_name['path']; 77 + } else { 78 + $path_view = null; 79 + } 80 + 81 + $rows[] = array( 82 + $repository_id, 83 + $repository_link, 84 + $path_id, 85 + $path_view, 86 + ); 87 + } 88 + 89 + // Sort rows by path name. 90 + $rows = isort($rows, 3); 91 + 92 + $table_view = id(new AphrontTableView($rows)) 93 + ->setNoDataString(pht('This revision has no indexed affected paths.')) 94 + ->setHeaders( 95 + array( 96 + pht('Repository ID'), 97 + pht('Repository'), 98 + pht('Path ID'), 99 + pht('Path'), 100 + )) 101 + ->setColumnClasses( 102 + array( 103 + null, 104 + null, 105 + null, 106 + 'wide', 107 + )); 108 + 109 + $box_view = id(new PHUIObjectBoxView()) 110 + ->setHeaderText(pht('Affected Path Index')) 111 + ->setTable($table_view); 112 + 113 + $crumbs = $this->buildApplicationCrumbs() 114 + ->addTextCrumb($revision->getMonogram(), $revision->getURI()) 115 + ->addTextCrumb(pht('Affected Path Index')); 116 + 117 + return $this->newPage() 118 + ->setCrumbs($crumbs) 119 + ->setTitle( 120 + array( 121 + $revision->getMonogram(), 122 + pht('Affected Path Index'), 123 + )) 124 + ->appendChild($box_view); 125 + } 126 + 127 + }
+10
src/applications/system/events/PhabricatorSystemDebugUIEventListener.php
··· 44 44 ->setName(pht('View Hovercard')) 45 45 ->setHref(urisprintf('/search/hovercard/?names=%s', $phid)); 46 46 47 + if ($object instanceof DifferentialRevision) { 48 + $submenu[] = id(new PhabricatorActionView()) 49 + ->setIcon('fa-database') 50 + ->setName(pht('View Affected Path Index')) 51 + ->setHref( 52 + urisprintf( 53 + '/differential/revision/paths/%s/', 54 + $object->getID())); 55 + } 56 + 47 57 $developer_action = id(new PhabricatorActionView()) 48 58 ->setName(pht('Advanced/Developer...')) 49 59 ->setIcon('fa-magic')