mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 18:51:12 +01:00
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
This commit is contained in:
parent
bdd1edea7a
commit
2794c69db5
9 changed files with 8 additions and 83 deletions
|
@ -559,7 +559,6 @@ abstract class PhabricatorController extends AphrontController {
|
|||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($object->getPHID()))
|
||||
->needComments(true)
|
||||
->setReversePaging(false)
|
||||
->executeWithCursorPager($pager);
|
||||
$xactions = array_reverse($xactions);
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
final class PhabricatorConfigHistoryController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
@ -11,7 +10,6 @@ final class PhabricatorConfigHistoryController
|
|||
$xactions = id(new PhabricatorConfigTransactionQuery())
|
||||
->setViewer($user)
|
||||
->needComments(true)
|
||||
->setReversePaging(false)
|
||||
->execute();
|
||||
|
||||
$object = new PhabricatorConfigEntry();
|
||||
|
|
|
@ -7,8 +7,9 @@ final class ConpherenceTransactionQuery
|
|||
return new ConpherenceTransaction();
|
||||
}
|
||||
|
||||
protected function getReversePaging() {
|
||||
return false;
|
||||
protected function getDefaultOrderVector() {
|
||||
// TODO: Can we get rid of this?
|
||||
return array('-id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -112,8 +112,9 @@ final class DifferentialHunkQuery
|
|||
return 'PhabricatorDifferentialApplication';
|
||||
}
|
||||
|
||||
protected function getReversePaging() {
|
||||
return true;
|
||||
protected function getDefaultOrderVector() {
|
||||
// TODO: Do we need this?
|
||||
return array('-id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -118,10 +118,6 @@ final class PonderAnswerQuery
|
|||
return $answers;
|
||||
}
|
||||
|
||||
protected function getReversePaging() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getQueryApplicationClass() {
|
||||
return 'PhabricatorPonderApplication';
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ final class PonderQuestionQuery
|
|||
if ($this->needAnswers) {
|
||||
$aquery = id(new PonderAnswerQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->setOrderVector(array('-id'))
|
||||
->withQuestionIDs(mpull($questions, 'getID'));
|
||||
|
||||
if ($this->needViewerVotes) {
|
||||
|
|
|
@ -312,7 +312,7 @@ final class PhabricatorRepositoryQuery
|
|||
return $repositories;
|
||||
}
|
||||
|
||||
public function getPrimaryTableAlias() {
|
||||
protected function getPrimaryTableAlias() {
|
||||
return 'r';
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ abstract class PhabricatorApplicationTransactionQuery
|
|||
private $objectPHIDs;
|
||||
private $authorPHIDs;
|
||||
private $transactionTypes;
|
||||
private $reversePaging = true;
|
||||
|
||||
private $needComments = true;
|
||||
private $needHandles = true;
|
||||
|
@ -18,15 +17,6 @@ abstract class PhabricatorApplicationTransactionQuery
|
|||
return array();
|
||||
}
|
||||
|
||||
public function setReversePaging($bool) {
|
||||
$this->reversePaging = $bool;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getReversePaging() {
|
||||
return $this->reversePaging;
|
||||
}
|
||||
|
||||
public function withPHIDs(array $phids) {
|
||||
$this->phids = $phids;
|
||||
return $this;
|
||||
|
|
|
@ -18,10 +18,6 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
private $internalPaging;
|
||||
private $orderVector;
|
||||
|
||||
protected function getPagingColumn() {
|
||||
return 'id';
|
||||
}
|
||||
|
||||
protected function getPagingValue($result) {
|
||||
if (!is_object($result)) {
|
||||
// This interface can't be typehinted and PHP gets really angry if we
|
||||
|
@ -31,10 +27,6 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
return $result->getID();
|
||||
}
|
||||
|
||||
protected function getReversePaging() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function nextPage(array $page) {
|
||||
// See getPagingViewer() for a description of this flag.
|
||||
$this->internalPaging = true;
|
||||
|
@ -171,28 +163,6 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
|
||||
protected function buildPagingClause(AphrontDatabaseConnection $conn) {
|
||||
$orderable = $this->getOrderableColumns();
|
||||
|
||||
// TODO: Remove this once subqueries modernize.
|
||||
if (!$orderable) {
|
||||
if ($this->beforeID) {
|
||||
return qsprintf(
|
||||
$conn,
|
||||
'%Q %Q %s',
|
||||
$this->getPagingColumn(),
|
||||
$this->getReversePaging() ? '<' : '>',
|
||||
$this->beforeID);
|
||||
} else if ($this->afterID) {
|
||||
return qsprintf(
|
||||
$conn,
|
||||
'%Q %Q %s',
|
||||
$this->getPagingColumn(),
|
||||
$this->getReversePaging() ? '>' : '<',
|
||||
$this->afterID);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
$vector = $this->getOrderVector();
|
||||
|
||||
if ($this->beforeID !== null) {
|
||||
|
@ -543,13 +513,6 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
* @task order
|
||||
*/
|
||||
public function getOrderableColumns() {
|
||||
// TODO: Remove this once all subclasses move off the old stuff.
|
||||
if ($this->getPagingColumn() !== 'id') {
|
||||
// This class has bad old custom logic around paging, so return nothing
|
||||
// here. This deactivates the new order code.
|
||||
return array();
|
||||
}
|
||||
|
||||
$columns = array(
|
||||
'id' => array(
|
||||
'table' => $this->getPrimaryTableAlias(),
|
||||
|
@ -593,26 +556,6 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
*/
|
||||
final protected function buildOrderClause(AphrontDatabaseConnection $conn) {
|
||||
$orderable = $this->getOrderableColumns();
|
||||
|
||||
// TODO: Remove this once all subclasses move off the old stuff. We'll
|
||||
// only enter this block for code using older ordering mechanisms. New
|
||||
// code should expose an orderable column list.
|
||||
if (!$orderable) {
|
||||
if ($this->beforeID) {
|
||||
return qsprintf(
|
||||
$conn,
|
||||
'ORDER BY %Q %Q',
|
||||
$this->getPagingColumn(),
|
||||
$this->getReversePaging() ? 'DESC' : 'ASC');
|
||||
} else {
|
||||
return qsprintf(
|
||||
$conn,
|
||||
'ORDER BY %Q %Q',
|
||||
$this->getPagingColumn(),
|
||||
$this->getReversePaging() ? 'ASC' : 'DESC');
|
||||
}
|
||||
}
|
||||
|
||||
$vector = $this->getOrderVector();
|
||||
|
||||
$parts = array();
|
||||
|
@ -636,10 +579,6 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
array $parts) {
|
||||
|
||||
$is_query_reversed = false;
|
||||
if ($this->getReversePaging()) {
|
||||
$is_query_reversed = !$is_query_reversed;
|
||||
}
|
||||
|
||||
if ($this->getBeforeID()) {
|
||||
$is_query_reversed = !$is_query_reversed;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue