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

Remove getPagingColumn() / getReversePaging()

Summary: Ref T7803. Remove these in favor of more generalized paging and ordering.

Test Plan: Sorted and paged results in various applications.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

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

+8 -83
-1
src/applications/base/controller/PhabricatorController.php
··· 559 559 ->setViewer($viewer) 560 560 ->withObjectPHIDs(array($object->getPHID())) 561 561 ->needComments(true) 562 - ->setReversePaging(false) 563 562 ->executeWithCursorPager($pager); 564 563 $xactions = array_reverse($xactions); 565 564
-2
src/applications/config/controller/PhabricatorConfigHistoryController.php
··· 3 3 final class PhabricatorConfigHistoryController 4 4 extends PhabricatorConfigController { 5 5 6 - 7 6 public function processRequest() { 8 7 $request = $this->getRequest(); 9 8 $user = $request->getUser(); ··· 11 10 $xactions = id(new PhabricatorConfigTransactionQuery()) 12 11 ->setViewer($user) 13 12 ->needComments(true) 14 - ->setReversePaging(false) 15 13 ->execute(); 16 14 17 15 $object = new PhabricatorConfigEntry();
+3 -2
src/applications/conpherence/query/ConpherenceTransactionQuery.php
··· 7 7 return new ConpherenceTransaction(); 8 8 } 9 9 10 - protected function getReversePaging() { 11 - return false; 10 + protected function getDefaultOrderVector() { 11 + // TODO: Can we get rid of this? 12 + return array('-id'); 12 13 } 13 14 14 15 }
+3 -2
src/applications/differential/query/DifferentialHunkQuery.php
··· 112 112 return 'PhabricatorDifferentialApplication'; 113 113 } 114 114 115 - protected function getReversePaging() { 116 - return true; 115 + protected function getDefaultOrderVector() { 116 + // TODO: Do we need this? 117 + return array('-id'); 117 118 } 118 119 119 120 }
-4
src/applications/ponder/query/PonderAnswerQuery.php
··· 118 118 return $answers; 119 119 } 120 120 121 - protected function getReversePaging() { 122 - return true; 123 - } 124 - 125 121 public function getQueryApplicationClass() { 126 122 return 'PhabricatorPonderApplication'; 127 123 }
+1
src/applications/ponder/query/PonderQuestionQuery.php
··· 141 141 if ($this->needAnswers) { 142 142 $aquery = id(new PonderAnswerQuery()) 143 143 ->setViewer($this->getViewer()) 144 + ->setOrderVector(array('-id')) 144 145 ->withQuestionIDs(mpull($questions, 'getID')); 145 146 146 147 if ($this->needViewerVotes) {
+1 -1
src/applications/repository/query/PhabricatorRepositoryQuery.php
··· 312 312 return $repositories; 313 313 } 314 314 315 - public function getPrimaryTableAlias() { 315 + protected function getPrimaryTableAlias() { 316 316 return 'r'; 317 317 } 318 318
-10
src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
··· 7 7 private $objectPHIDs; 8 8 private $authorPHIDs; 9 9 private $transactionTypes; 10 - private $reversePaging = true; 11 10 12 11 private $needComments = true; 13 12 private $needHandles = true; ··· 16 15 17 16 protected function buildMoreWhereClauses(AphrontDatabaseConnection $conn_r) { 18 17 return array(); 19 - } 20 - 21 - public function setReversePaging($bool) { 22 - $this->reversePaging = $bool; 23 - return $this; 24 - } 25 - 26 - protected function getReversePaging() { 27 - return $this->reversePaging; 28 18 } 29 19 30 20 public function withPHIDs(array $phids) {
-61
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 18 18 private $internalPaging; 19 19 private $orderVector; 20 20 21 - protected function getPagingColumn() { 22 - return 'id'; 23 - } 24 - 25 21 protected function getPagingValue($result) { 26 22 if (!is_object($result)) { 27 23 // This interface can't be typehinted and PHP gets really angry if we ··· 29 25 throw new Exception(pht('Expected object, got "%s"!', gettype($result))); 30 26 } 31 27 return $result->getID(); 32 - } 33 - 34 - protected function getReversePaging() { 35 - return false; 36 28 } 37 29 38 30 protected function nextPage(array $page) { ··· 171 163 172 164 protected function buildPagingClause(AphrontDatabaseConnection $conn) { 173 165 $orderable = $this->getOrderableColumns(); 174 - 175 - // TODO: Remove this once subqueries modernize. 176 - if (!$orderable) { 177 - if ($this->beforeID) { 178 - return qsprintf( 179 - $conn, 180 - '%Q %Q %s', 181 - $this->getPagingColumn(), 182 - $this->getReversePaging() ? '<' : '>', 183 - $this->beforeID); 184 - } else if ($this->afterID) { 185 - return qsprintf( 186 - $conn, 187 - '%Q %Q %s', 188 - $this->getPagingColumn(), 189 - $this->getReversePaging() ? '>' : '<', 190 - $this->afterID); 191 - } else { 192 - return null; 193 - } 194 - } 195 - 196 166 $vector = $this->getOrderVector(); 197 167 198 168 if ($this->beforeID !== null) { ··· 543 513 * @task order 544 514 */ 545 515 public function getOrderableColumns() { 546 - // TODO: Remove this once all subclasses move off the old stuff. 547 - if ($this->getPagingColumn() !== 'id') { 548 - // This class has bad old custom logic around paging, so return nothing 549 - // here. This deactivates the new order code. 550 - return array(); 551 - } 552 - 553 516 $columns = array( 554 517 'id' => array( 555 518 'table' => $this->getPrimaryTableAlias(), ··· 593 556 */ 594 557 final protected function buildOrderClause(AphrontDatabaseConnection $conn) { 595 558 $orderable = $this->getOrderableColumns(); 596 - 597 - // TODO: Remove this once all subclasses move off the old stuff. We'll 598 - // only enter this block for code using older ordering mechanisms. New 599 - // code should expose an orderable column list. 600 - if (!$orderable) { 601 - if ($this->beforeID) { 602 - return qsprintf( 603 - $conn, 604 - 'ORDER BY %Q %Q', 605 - $this->getPagingColumn(), 606 - $this->getReversePaging() ? 'DESC' : 'ASC'); 607 - } else { 608 - return qsprintf( 609 - $conn, 610 - 'ORDER BY %Q %Q', 611 - $this->getPagingColumn(), 612 - $this->getReversePaging() ? 'ASC' : 'DESC'); 613 - } 614 - } 615 - 616 559 $vector = $this->getOrderVector(); 617 560 618 561 $parts = array(); ··· 636 579 array $parts) { 637 580 638 581 $is_query_reversed = false; 639 - if ($this->getReversePaging()) { 640 - $is_query_reversed = !$is_query_reversed; 641 - } 642 - 643 582 if ($this->getBeforeID()) { 644 583 $is_query_reversed = !$is_query_reversed; 645 584 }