@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.

Move Diffusion to "withPaths()" for "Recent Open Revisions", and remove "withPath()" from DifferentialRevisionQuery

Summary: Ref T13639. Move Diffusion to use the new API and get rid of the old API now that it no longer has any callers.

Test Plan:
Grepped for remaining callers.

{F8539335}

Maniphest Tasks: T13639

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

+2 -53
-46
src/applications/differential/query/DifferentialRevisionQuery.php
··· 8 8 final class DifferentialRevisionQuery 9 9 extends PhabricatorCursorPagedPolicyAwareQuery { 10 10 11 - private $pathIDs = array(); 12 - 13 11 private $authors = array(); 14 12 private $draftAuthors = array(); 15 13 private $ccs = array(); ··· 43 41 44 42 45 43 /* -( Query Configuration )------------------------------------------------ */ 46 - 47 - 48 - /** 49 - * Filter results to revisions which affect a Diffusion path ID in a given 50 - * repository. You can call this multiple times to select revisions for 51 - * several paths. 52 - * 53 - * @param int Diffusion repository ID. 54 - * @param int Diffusion path ID. 55 - * @return this 56 - * @task config 57 - */ 58 - public function withPath($repository_id, $path_id) { 59 - $this->pathIDs[] = array( 60 - 'repositoryID' => $repository_id, 61 - 'pathID' => $path_id, 62 - ); 63 - return $this; 64 - } 65 44 66 45 /** 67 46 * Find revisions affecting one or more items in a list of paths. ··· 581 560 */ 582 561 private function buildJoinsClause(AphrontDatabaseConnection $conn) { 583 562 $joins = array(); 584 - if ($this->pathIDs) { 585 - $path_table = new DifferentialAffectedPath(); 586 - $joins[] = qsprintf( 587 - $conn, 588 - 'JOIN %T p ON p.revisionID = r.id', 589 - $path_table->getTableName()); 590 - } 591 563 592 564 if ($this->paths) { 593 565 $path_table = new DifferentialAffectedPath(); ··· 658 630 protected function buildWhereClause(AphrontDatabaseConnection $conn) { 659 631 $viewer = $this->getViewer(); 660 632 $where = array(); 661 - 662 - if ($this->pathIDs) { 663 - $path_clauses = array(); 664 - $repo_info = igroup($this->pathIDs, 'repositoryID'); 665 - foreach ($repo_info as $repository_id => $paths) { 666 - $path_clauses[] = qsprintf( 667 - $conn, 668 - '(p.repositoryID = %d AND p.pathID IN (%Ld))', 669 - $repository_id, 670 - ipull($paths, 'pathID')); 671 - } 672 - $path_clauses = qsprintf($conn, '%LO', $path_clauses); 673 - $where[] = $path_clauses; 674 - } 675 633 676 634 if ($this->paths !== null) { 677 635 $paths = $this->paths; ··· 838 796 * @task internal 839 797 */ 840 798 protected function shouldGroupQueryResultRows() { 841 - 842 - if (count($this->pathIDs) > 1) { 843 - return true; 844 - } 845 799 846 800 if ($this->paths) { 847 801 // (If we have exactly one repository and exactly one path, we don't
+2 -7
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 938 938 $repository = $drequest->getRepository(); 939 939 $path = $drequest->getPath(); 940 940 941 - $path_map = id(new DiffusionPathIDQuery(array($path)))->loadPathIDs(); 942 - $path_id = idx($path_map, $path); 943 - if (!$path_id) { 944 - return null; 945 - } 946 - 947 941 $recent = (PhabricatorTime::getNow() - phutil_units('30 days in seconds')); 948 942 949 943 $revisions = id(new DifferentialRevisionQuery()) 950 944 ->setViewer($viewer) 951 - ->withPath($repository->getID(), $path_id) 945 + ->withPaths(array($path)) 946 + ->withRepositoryPHIDs(array($repository->getPHID())) 952 947 ->withIsOpen(true) 953 948 ->withUpdatedEpochBetween($recent, null) 954 949 ->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED)