mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Rename "IDPaged" to "CursorPaged", "executeWithPager" to "executeWith[Cursor|Offset]Pager"
Summary: I'm trying to make progress on the policy/visibility stuff since it's a blocker for Wikimedia. First, I want to improve Projects so they can serve as policy groups (e.g., an object can have a visibility policy like "Visible to: members of project 'security'"). However, doing this without breaking anything or snowballing into a bigger change is a bit awkward because Projects are name-ordered and we have a Conduit API which does offset paging. Rather than breaking or rewriting this stuff, I want to just continue offset paging them for now. So I'm going to make PhabricatorPolicyQuery extend PhabricatorOffsetPagedQuery, but can't currently since the `executeWithPager` methods would clash. These methods do different things anyway and are probably better with different names. This also generally improves the names of these classes, since cursors are not necessarily IDs (in the feed case, they're "chronlogicalKeys", for example). I did leave some of the interals as "ID" since calling them "Cursor"s (e.g., `setAfterCursor()`) seemed a little wrong -- it should maybe be `setAfterCursorPosition()`. These APIs have very limited use and can easily be made more consistent later. Test Plan: Browsed around various affected tools; any issues here should throw/fail in a loud/obvious way. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D3177
This commit is contained in:
parent
8ab1789329
commit
ed4a155c91
21 changed files with 35 additions and 34 deletions
|
@ -23,6 +23,7 @@ phutil_register_library_map(array(
|
||||||
'AphrontContextBarView' => 'view/layout/AphrontContextBarView.php',
|
'AphrontContextBarView' => 'view/layout/AphrontContextBarView.php',
|
||||||
'AphrontController' => 'aphront/AphrontController.php',
|
'AphrontController' => 'aphront/AphrontController.php',
|
||||||
'AphrontCrumbsView' => 'view/layout/AphrontCrumbsView.php',
|
'AphrontCrumbsView' => 'view/layout/AphrontCrumbsView.php',
|
||||||
|
'AphrontCursorPagerView' => 'view/control/AphrontCursorPagerView.php',
|
||||||
'AphrontDefaultApplicationConfiguration' => 'aphront/configuration/AphrontDefaultApplicationConfiguration.php',
|
'AphrontDefaultApplicationConfiguration' => 'aphront/configuration/AphrontDefaultApplicationConfiguration.php',
|
||||||
'AphrontDialogResponse' => 'aphront/response/AphrontDialogResponse.php',
|
'AphrontDialogResponse' => 'aphront/response/AphrontDialogResponse.php',
|
||||||
'AphrontDialogView' => 'view/AphrontDialogView.php',
|
'AphrontDialogView' => 'view/AphrontDialogView.php',
|
||||||
|
@ -57,7 +58,6 @@ phutil_register_library_map(array(
|
||||||
'AphrontHeadsupActionListView' => 'view/layout/headsup/AphrontHeadsupActionListView.php',
|
'AphrontHeadsupActionListView' => 'view/layout/headsup/AphrontHeadsupActionListView.php',
|
||||||
'AphrontHeadsupActionView' => 'view/layout/headsup/AphrontHeadsupActionView.php',
|
'AphrontHeadsupActionView' => 'view/layout/headsup/AphrontHeadsupActionView.php',
|
||||||
'AphrontHeadsupView' => 'view/layout/headsup/AphrontHeadsupView.php',
|
'AphrontHeadsupView' => 'view/layout/headsup/AphrontHeadsupView.php',
|
||||||
'AphrontIDPagerView' => 'view/control/AphrontIDPagerView.php',
|
|
||||||
'AphrontIsolatedDatabaseConnectionTestCase' => 'infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php',
|
'AphrontIsolatedDatabaseConnectionTestCase' => 'infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php',
|
||||||
'AphrontIsolatedHTTPSink' => 'aphront/sink/AphrontIsolatedHTTPSink.php',
|
'AphrontIsolatedHTTPSink' => 'aphront/sink/AphrontIsolatedHTTPSink.php',
|
||||||
'AphrontJSONResponse' => 'aphront/response/AphrontJSONResponse.php',
|
'AphrontJSONResponse' => 'aphront/response/AphrontJSONResponse.php',
|
||||||
|
@ -606,6 +606,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorCountdownEditController' => 'applications/countdown/controller/PhabricatorCountdownEditController.php',
|
'PhabricatorCountdownEditController' => 'applications/countdown/controller/PhabricatorCountdownEditController.php',
|
||||||
'PhabricatorCountdownListController' => 'applications/countdown/controller/PhabricatorCountdownListController.php',
|
'PhabricatorCountdownListController' => 'applications/countdown/controller/PhabricatorCountdownListController.php',
|
||||||
'PhabricatorCountdownViewController' => 'applications/countdown/controller/PhabricatorCountdownViewController.php',
|
'PhabricatorCountdownViewController' => 'applications/countdown/controller/PhabricatorCountdownViewController.php',
|
||||||
|
'PhabricatorCursorPagedPolicyQuery' => 'infrastructure/query/policy/PhabricatorCursorPagedPolicyQuery.php',
|
||||||
'PhabricatorDaemon' => 'infrastructure/daemon/PhabricatorDaemon.php',
|
'PhabricatorDaemon' => 'infrastructure/daemon/PhabricatorDaemon.php',
|
||||||
'PhabricatorDaemonCombinedLogController' => 'applications/daemon/controller/PhabricatorDaemonCombinedLogController.php',
|
'PhabricatorDaemonCombinedLogController' => 'applications/daemon/controller/PhabricatorDaemonCombinedLogController.php',
|
||||||
'PhabricatorDaemonConsoleController' => 'applications/daemon/controller/PhabricatorDaemonConsoleController.php',
|
'PhabricatorDaemonConsoleController' => 'applications/daemon/controller/PhabricatorDaemonConsoleController.php',
|
||||||
|
@ -734,7 +735,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorHash' => 'infrastructure/util/PhabricatorHash.php',
|
'PhabricatorHash' => 'infrastructure/util/PhabricatorHash.php',
|
||||||
'PhabricatorHelpController' => 'applications/help/controller/PhabricatorHelpController.php',
|
'PhabricatorHelpController' => 'applications/help/controller/PhabricatorHelpController.php',
|
||||||
'PhabricatorHelpKeyboardShortcutController' => 'applications/help/controller/PhabricatorHelpKeyboardShortcutController.php',
|
'PhabricatorHelpKeyboardShortcutController' => 'applications/help/controller/PhabricatorHelpKeyboardShortcutController.php',
|
||||||
'PhabricatorIDPagedPolicyQuery' => 'infrastructure/query/policy/PhabricatorIDPagedPolicyQuery.php',
|
|
||||||
'PhabricatorIRCBot' => 'infrastructure/daemon/irc/PhabricatorIRCBot.php',
|
'PhabricatorIRCBot' => 'infrastructure/daemon/irc/PhabricatorIRCBot.php',
|
||||||
'PhabricatorIRCDifferentialNotificationHandler' => 'infrastructure/daemon/irc/handler/PhabricatorIRCDifferentialNotificationHandler.php',
|
'PhabricatorIRCDifferentialNotificationHandler' => 'infrastructure/daemon/irc/handler/PhabricatorIRCDifferentialNotificationHandler.php',
|
||||||
'PhabricatorIRCHandler' => 'infrastructure/daemon/irc/handler/PhabricatorIRCHandler.php',
|
'PhabricatorIRCHandler' => 'infrastructure/daemon/irc/handler/PhabricatorIRCHandler.php',
|
||||||
|
@ -1168,6 +1168,7 @@ phutil_register_library_map(array(
|
||||||
'AphrontCalendarMonthView' => 'AphrontView',
|
'AphrontCalendarMonthView' => 'AphrontView',
|
||||||
'AphrontContextBarView' => 'AphrontView',
|
'AphrontContextBarView' => 'AphrontView',
|
||||||
'AphrontCrumbsView' => 'AphrontView',
|
'AphrontCrumbsView' => 'AphrontView',
|
||||||
|
'AphrontCursorPagerView' => 'AphrontView',
|
||||||
'AphrontDefaultApplicationConfiguration' => 'AphrontApplicationConfiguration',
|
'AphrontDefaultApplicationConfiguration' => 'AphrontApplicationConfiguration',
|
||||||
'AphrontDialogResponse' => 'AphrontResponse',
|
'AphrontDialogResponse' => 'AphrontResponse',
|
||||||
'AphrontDialogView' => 'AphrontView',
|
'AphrontDialogView' => 'AphrontView',
|
||||||
|
@ -1201,7 +1202,6 @@ phutil_register_library_map(array(
|
||||||
'AphrontHeadsupActionListView' => 'AphrontView',
|
'AphrontHeadsupActionListView' => 'AphrontView',
|
||||||
'AphrontHeadsupActionView' => 'AphrontView',
|
'AphrontHeadsupActionView' => 'AphrontView',
|
||||||
'AphrontHeadsupView' => 'AphrontView',
|
'AphrontHeadsupView' => 'AphrontView',
|
||||||
'AphrontIDPagerView' => 'AphrontView',
|
|
||||||
'AphrontIsolatedDatabaseConnectionTestCase' => 'PhabricatorTestCase',
|
'AphrontIsolatedDatabaseConnectionTestCase' => 'PhabricatorTestCase',
|
||||||
'AphrontIsolatedHTTPSink' => 'AphrontHTTPSink',
|
'AphrontIsolatedHTTPSink' => 'AphrontHTTPSink',
|
||||||
'AphrontJSONResponse' => 'AphrontResponse',
|
'AphrontJSONResponse' => 'AphrontResponse',
|
||||||
|
@ -1667,7 +1667,7 @@ phutil_register_library_map(array(
|
||||||
1 => 'PhabricatorPolicyInterface',
|
1 => 'PhabricatorPolicyInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorChatLogEventType' => 'PhabricatorChatLogConstants',
|
'PhabricatorChatLogEventType' => 'PhabricatorChatLogConstants',
|
||||||
'PhabricatorChatLogQuery' => 'PhabricatorIDPagedPolicyQuery',
|
'PhabricatorChatLogQuery' => 'PhabricatorCursorPagedPolicyQuery',
|
||||||
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',
|
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',
|
||||||
'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO',
|
'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO',
|
||||||
'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO',
|
'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO',
|
||||||
|
@ -1686,6 +1686,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorCountdownEditController' => 'PhabricatorCountdownController',
|
'PhabricatorCountdownEditController' => 'PhabricatorCountdownController',
|
||||||
'PhabricatorCountdownListController' => 'PhabricatorCountdownController',
|
'PhabricatorCountdownListController' => 'PhabricatorCountdownController',
|
||||||
'PhabricatorCountdownViewController' => 'PhabricatorCountdownController',
|
'PhabricatorCountdownViewController' => 'PhabricatorCountdownController',
|
||||||
|
'PhabricatorCursorPagedPolicyQuery' => 'PhabricatorPolicyQuery',
|
||||||
'PhabricatorDaemon' => 'PhutilDaemon',
|
'PhabricatorDaemon' => 'PhutilDaemon',
|
||||||
'PhabricatorDaemonCombinedLogController' => 'PhabricatorDaemonController',
|
'PhabricatorDaemonCombinedLogController' => 'PhabricatorDaemonController',
|
||||||
'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController',
|
'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController',
|
||||||
|
@ -1741,7 +1742,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorFeedController' => 'PhabricatorController',
|
'PhabricatorFeedController' => 'PhabricatorController',
|
||||||
'PhabricatorFeedDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorFeedDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorFeedPublicStreamController' => 'PhabricatorFeedController',
|
'PhabricatorFeedPublicStreamController' => 'PhabricatorFeedController',
|
||||||
'PhabricatorFeedQuery' => 'PhabricatorIDPagedPolicyQuery',
|
'PhabricatorFeedQuery' => 'PhabricatorCursorPagedPolicyQuery',
|
||||||
'PhabricatorFeedStory' => 'PhabricatorPolicyInterface',
|
'PhabricatorFeedStory' => 'PhabricatorPolicyInterface',
|
||||||
'PhabricatorFeedStoryAggregate' => 'PhabricatorFeedStory',
|
'PhabricatorFeedStoryAggregate' => 'PhabricatorFeedStory',
|
||||||
'PhabricatorFeedStoryAudit' => 'PhabricatorFeedStory',
|
'PhabricatorFeedStoryAudit' => 'PhabricatorFeedStory',
|
||||||
|
@ -1795,7 +1796,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorGoodForNothingWorker' => 'PhabricatorWorker',
|
'PhabricatorGoodForNothingWorker' => 'PhabricatorWorker',
|
||||||
'PhabricatorHelpController' => 'PhabricatorController',
|
'PhabricatorHelpController' => 'PhabricatorController',
|
||||||
'PhabricatorHelpKeyboardShortcutController' => 'PhabricatorHelpController',
|
'PhabricatorHelpKeyboardShortcutController' => 'PhabricatorHelpController',
|
||||||
'PhabricatorIDPagedPolicyQuery' => 'PhabricatorPolicyQuery',
|
|
||||||
'PhabricatorIRCBot' => 'PhabricatorDaemon',
|
'PhabricatorIRCBot' => 'PhabricatorDaemon',
|
||||||
'PhabricatorIRCDifferentialNotificationHandler' => 'PhabricatorIRCHandler',
|
'PhabricatorIRCDifferentialNotificationHandler' => 'PhabricatorIRCHandler',
|
||||||
'PhabricatorIRCLogHandler' => 'PhabricatorIRCHandler',
|
'PhabricatorIRCLogHandler' => 'PhabricatorIRCHandler',
|
||||||
|
@ -1911,7 +1911,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPasteController' => 'PhabricatorController',
|
'PhabricatorPasteController' => 'PhabricatorController',
|
||||||
'PhabricatorPasteDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorPasteDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorPasteListController' => 'PhabricatorPasteController',
|
'PhabricatorPasteListController' => 'PhabricatorPasteController',
|
||||||
'PhabricatorPasteQuery' => 'PhabricatorIDPagedPolicyQuery',
|
'PhabricatorPasteQuery' => 'PhabricatorCursorPagedPolicyQuery',
|
||||||
'PhabricatorPasteViewController' => 'PhabricatorPasteController',
|
'PhabricatorPasteViewController' => 'PhabricatorPasteController',
|
||||||
'PhabricatorPeopleController' => 'PhabricatorController',
|
'PhabricatorPeopleController' => 'PhabricatorController',
|
||||||
'PhabricatorPeopleEditController' => 'PhabricatorPeopleController',
|
'PhabricatorPeopleEditController' => 'PhabricatorPeopleController',
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final class PhabricatorChatLogQuery extends PhabricatorIDPagedPolicyQuery {
|
final class PhabricatorChatLogQuery extends PhabricatorCursorPagedPolicyQuery {
|
||||||
|
|
||||||
private $channels;
|
private $channels;
|
||||||
private $maximumEpoch;
|
private $maximumEpoch;
|
||||||
|
|
|
@ -32,7 +32,7 @@ final class PhabricatorChatLogChannelLogController
|
||||||
$uri = clone $request->getRequestURI();
|
$uri = clone $request->getRequestURI();
|
||||||
$uri->setQueryParams(array());
|
$uri->setQueryParams(array());
|
||||||
|
|
||||||
$pager = new AphrontIDPagerView();
|
$pager = new AphrontCursorPagerView();
|
||||||
$pager->setURI($uri);
|
$pager->setURI($uri);
|
||||||
$pager->setPageSize(250);
|
$pager->setPageSize(250);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ final class PhabricatorChatLogChannelLogController
|
||||||
$pager->setAfterID($after);
|
$pager->setAfterID($after);
|
||||||
$pager->setBeforeID($before);
|
$pager->setBeforeID($before);
|
||||||
|
|
||||||
$logs = $query->executeWithPager($pager);
|
$logs = $query->executeWithCursorPager($pager);
|
||||||
|
|
||||||
// Show chat logs oldest-first.
|
// Show chat logs oldest-first.
|
||||||
$logs = array_reverse($logs);
|
$logs = array_reverse($logs);
|
||||||
|
|
|
@ -35,7 +35,7 @@ final class PhabricatorChatLogEvent
|
||||||
|
|
||||||
public function getPolicy($capability) {
|
public function getPolicy($capability) {
|
||||||
// TODO: This is sort of silly and mostly just so that we can use
|
// TODO: This is sort of silly and mostly just so that we can use
|
||||||
// IDPagedPolicyQuery; once we implement Channel objects we should
|
// CursorPagedPolicyQuery; once we implement Channel objects we should
|
||||||
// just delegate policy to them.
|
// just delegate policy to them.
|
||||||
return PhabricatorPolicies::POLICY_PUBLIC;
|
return PhabricatorPolicies::POLICY_PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,11 +402,11 @@ final class PhabricatorDirectoryMainController
|
||||||
$feed_query->setFilterPHIDs($phids);
|
$feed_query->setFilterPHIDs($phids);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pager = new AphrontIDPagerView();
|
$pager = new AphrontCursorPagerView();
|
||||||
$pager->readFromRequest($request);
|
$pager->readFromRequest($request);
|
||||||
$pager->setPageSize(200);
|
$pager->setPageSize(200);
|
||||||
|
|
||||||
$feed = $feed_query->executeWithPager($pager);
|
$feed = $feed_query->executeWithCursorPager($pager);
|
||||||
|
|
||||||
$builder = new PhabricatorFeedBuilder($feed);
|
$builder = new PhabricatorFeedBuilder($feed);
|
||||||
$builder->setUser($user);
|
$builder->setUser($user);
|
||||||
|
|
|
@ -41,7 +41,7 @@ final class DrydockLogController extends DrydockController {
|
||||||
$pager->setOffset($request->getInt('offset'));
|
$pager->setOffset($request->getInt('offset'));
|
||||||
$pager->setURI($request->getRequestURI(), 'offset');
|
$pager->setURI($request->getRequestURI(), 'offset');
|
||||||
|
|
||||||
$logs = $query->executeWithPager($pager);
|
$logs = $query->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($logs as $log) {
|
foreach ($logs as $log) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final class PhabricatorFeedQuery extends PhabricatorIDPagedPolicyQuery {
|
final class PhabricatorFeedQuery extends PhabricatorCursorPagedPolicyQuery {
|
||||||
|
|
||||||
private $filterPHIDs;
|
private $filterPHIDs;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ final class HeraldHomeController extends HeraldController {
|
||||||
$pager->setURI($request->getRequestURI(), 'offset');
|
$pager->setURI($request->getRequestURI(), 'offset');
|
||||||
$pager->setOffset($request->getStr('offset'));
|
$pager->setOffset($request->getStr('offset'));
|
||||||
|
|
||||||
$rules = $query->executeWithPager($pager);
|
$rules = $query->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
$need_phids = mpull($rules, 'getAuthorPHID');
|
$need_phids = mpull($rules, 'getAuthorPHID');
|
||||||
$handles = id(new PhabricatorObjectHandleData($need_phids))
|
$handles = id(new PhabricatorObjectHandleData($need_phids))
|
||||||
|
|
|
@ -36,7 +36,7 @@ final class HeraldRuleEditHistoryController extends HeraldController {
|
||||||
$pager->setURI($request->getRequestURI(), 'offset');
|
$pager->setURI($request->getRequestURI(), 'offset');
|
||||||
$pager->setOffset($request->getStr('offset'));
|
$pager->setOffset($request->getStr('offset'));
|
||||||
|
|
||||||
$edits = $edit_query->executeWithPager($pager);
|
$edits = $edit_query->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
$need_phids = mpull($edits, 'getEditorPHID');
|
$need_phids = mpull($edits, 'getEditorPHID');
|
||||||
$handles = id(new PhabricatorObjectHandleData($need_phids))
|
$handles = id(new PhabricatorObjectHandleData($need_phids))
|
||||||
|
|
|
@ -54,7 +54,7 @@ final class PhabricatorNotificationListController
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$notifications = $query->executeWithPager($pager);
|
$notifications = $query->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
if ($notifications) {
|
if ($notifications) {
|
||||||
$builder = new PhabricatorNotificationBuilder($notifications);
|
$builder = new PhabricatorNotificationBuilder($notifications);
|
||||||
|
|
|
@ -40,7 +40,7 @@ extends PhabricatorOAuthClientBaseController {
|
||||||
|
|
||||||
$query = new PhabricatorOAuthServerClientQuery();
|
$query = new PhabricatorOAuthServerClientQuery();
|
||||||
$query->withCreatorPHIDs(array($current_user->getPHID()));
|
$query->withCreatorPHIDs(array($current_user->getPHID()));
|
||||||
$clients = $query->executeWithPager($pager);
|
$clients = $query->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rowc = array();
|
$rowc = array();
|
||||||
|
|
|
@ -40,7 +40,7 @@ extends PhabricatorOAuthClientAuthorizationBaseController {
|
||||||
|
|
||||||
$query = new PhabricatorOAuthClientAuthorizationQuery();
|
$query = new PhabricatorOAuthClientAuthorizationQuery();
|
||||||
$query->withUserPHIDs(array($current_user->getPHID()));
|
$query->withUserPHIDs(array($current_user->getPHID()));
|
||||||
$authorizations = $query->executeWithPager($pager);
|
$authorizations = $query->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
$client_authorizations = mpull($authorizations, null, 'getClientPHID');
|
$client_authorizations = mpull($authorizations, null, 'getClientPHID');
|
||||||
$client_phids = array_keys($client_authorizations);
|
$client_phids = array_keys($client_authorizations);
|
||||||
|
|
|
@ -73,7 +73,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
|
||||||
$pager = new AphrontIDPagerView();
|
$pager = new AphrontCursorPagerView();
|
||||||
$pager->readFromRequest($request);
|
$pager->readFromRequest($request);
|
||||||
|
|
||||||
$query = new PhabricatorPasteQuery();
|
$query = new PhabricatorPasteQuery();
|
||||||
|
@ -95,10 +95,10 @@ final class PhabricatorPasteListController extends PhabricatorPasteController {
|
||||||
break;
|
break;
|
||||||
case 'my':
|
case 'my':
|
||||||
$query->withAuthorPHIDs(array($user->getPHID()));
|
$query->withAuthorPHIDs(array($user->getPHID()));
|
||||||
$paste_list = $query->executeWithPager($pager);
|
$paste_list = $query->executeWithCursorPager($pager);
|
||||||
break;
|
break;
|
||||||
case 'all':
|
case 'all':
|
||||||
$paste_list = $query->executeWithPager($pager);
|
$paste_list = $query->executeWithCursorPager($pager);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final class PhabricatorPasteQuery extends PhabricatorIDPagedPolicyQuery {
|
final class PhabricatorPasteQuery extends PhabricatorCursorPagedPolicyQuery {
|
||||||
|
|
||||||
private $pasteIDs;
|
private $pasteIDs;
|
||||||
private $authorPHIDs;
|
private $authorPHIDs;
|
||||||
|
|
|
@ -39,7 +39,7 @@ final class PhabricatorPeopleListController
|
||||||
|
|
||||||
$users = id(new PhabricatorPeopleQuery())
|
$users = id(new PhabricatorPeopleQuery())
|
||||||
->needPrimaryEmail(true)
|
->needPrimaryEmail(true)
|
||||||
->executeWithPager($pager);
|
->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ final class PhameAllBlogListController
|
||||||
|
|
||||||
$blogs = id(new PhameBlogQuery())
|
$blogs = id(new PhameBlogQuery())
|
||||||
->needBloggers(true)
|
->needBloggers(true)
|
||||||
->executeWithPager($this->getPager());
|
->executeWithOffsetPager($this->getPager());
|
||||||
$this->setBlogs($blogs);
|
$this->setBlogs($blogs);
|
||||||
|
|
||||||
$page_title = 'All Blogs';
|
$page_title = 'All Blogs';
|
||||||
|
|
|
@ -51,7 +51,7 @@ final class PhameUserBlogListController
|
||||||
$blogs = id(new PhameBlogQuery())
|
$blogs = id(new PhameBlogQuery())
|
||||||
->withPHIDs($blog_phids)
|
->withPHIDs($blog_phids)
|
||||||
->needBloggers(true)
|
->needBloggers(true)
|
||||||
->executeWithPager($this->getPager());
|
->executeWithOffsetPager($this->getPager());
|
||||||
|
|
||||||
$this->setBlogs($blogs);
|
$this->setBlogs($blogs);
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ abstract class PhamePostListBaseController
|
||||||
protected function buildPostListPageResponse() {
|
protected function buildPostListPageResponse() {
|
||||||
$pager = $this->getPager();
|
$pager = $this->getPager();
|
||||||
$query = $this->getPhamePostQuery();
|
$query = $this->getPhamePostQuery();
|
||||||
$posts = $query->executeWithPager($pager);
|
$posts = $query->executeWithOffsetPager($pager);
|
||||||
|
|
||||||
$bloggers = $this->loadBloggersFromPosts($posts);
|
$bloggers = $this->loadBloggersFromPosts($posts);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ abstract class PhabricatorOffsetPagedQuery extends PhabricatorQuery {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function executeWithPager(AphrontPagerView $pager) {
|
final public function executeWithOffsetPager(AphrontPagerView $pager) {
|
||||||
$this->setLimit($pager->getPageSize() + 1);
|
$this->setLimit($pager->getPageSize() + 1);
|
||||||
$this->setOffset($pager->getOffset());
|
$this->setOffset($pager->getOffset());
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A query class which uses ID-based paging. This paging is much more performant
|
* A query class which uses cursor-based paging. This paging is much more
|
||||||
* than offset-based paging in the presence of policy filtering.
|
* performant than offset-based paging in the presence of policy filtering.
|
||||||
*/
|
*/
|
||||||
abstract class PhabricatorIDPagedPolicyQuery extends PhabricatorPolicyQuery {
|
abstract class PhabricatorCursorPagedPolicyQuery
|
||||||
|
extends PhabricatorPolicyQuery {
|
||||||
|
|
||||||
private $afterID;
|
private $afterID;
|
||||||
private $beforeID;
|
private $beforeID;
|
||||||
|
@ -101,7 +102,7 @@ abstract class PhabricatorIDPagedPolicyQuery extends PhabricatorPolicyQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final public function executeWithPager(AphrontIDPagerView $pager) {
|
final public function executeWithCursorPager(AphrontCursorPagerView $pager) {
|
||||||
$this->setLimit($pager->getPageSize() + 1);
|
$this->setLimit($pager->getPageSize() + 1);
|
||||||
|
|
||||||
if ($pager->getAfterID()) {
|
if ($pager->getAfterID()) {
|
|
@ -16,7 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
final class AphrontIDPagerView extends AphrontView {
|
final class AphrontCursorPagerView extends AphrontView {
|
||||||
|
|
||||||
private $afterID;
|
private $afterID;
|
||||||
private $beforeID;
|
private $beforeID;
|
Loading…
Reference in a new issue