1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-09 19:04:48 +01:00
phorge-phorge/src/applications/tokens/query/PhabricatorTokenReceiverQuery.php
Joshua Spence 86c399b657 Rename PhabricatorApplication subclasses
Summary: Ref T5655. Some discussion in D9839. Generally speaking, `Phabricator{$name}Application` is clearer than `PhabricatorApplication{$name}`.

Test Plan:
# Pinned and uninstalled some applications.
# Applied patch and performed migrations.
# Verified that the pinned applications were still pinned and that the uninstalled applications were still uninstalled.
# Performed a sanity check on the database contents.

Reviewers: btrahan, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: hach-que, epriestley, Korvin

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D9982
2014-07-23 10:03:09 +10:00

41 lines
983 B
PHP

<?php
final class PhabricatorTokenReceiverQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
private $tokenCounts;
protected function loadPage() {
$table = new PhabricatorTokenCount();
$conn_r = $table->establishConnection('r');
$rows = queryfx_all(
$conn_r,
'SELECT objectPHID, tokenCount FROM %T ORDER BY tokenCount DESC',
$table->getTableName());
$this->tokenCounts = ipull($rows, 'tokenCount', 'objectPHID');
return ipull($rows, 'objectPHID');
}
public function willFilterPage(array $phids) {
$objects = id(new PhabricatorObjectQuery())
->setViewer($this->getViewer())
->withPHIDs($phids)
->execute();
// Reorder the objects in the input order.
$objects = array_select_keys($objects, $phids);
return $objects;
}
public function getTokenCounts() {
return $this->tokenCounts;
}
public function getQueryApplicationClass() {
return 'PhabricatorTokensApplication';
}
}