I wasn't able to port some places that rely on isAllowed, getOption, or related methods. This adds isRegistered() to UserIdentity, which works like User::isLoggedIn() but with a better name. I also cleaned up User mocks in WatchedItemQueryServiceUnitTest in the course of debugging test failures when switching them to UserIdentityValue instead of mock Users where possible. They now specify explicitly which methods are allowed to be called on their User objects, which I believe is good practice for mocks (and unfortunately PHPUnit makes it awkward). Bug: T207972 Depends-On: I883d506197a011fe4c102b72df4d9deb58ab5ca2 Change-Id: Iadbf7bc31a496899dbef44e49065ff89f37aea89
59 lines
2.1 KiB
PHP
59 lines
2.1 KiB
PHP
<?php
|
|
|
|
use MediaWiki\User\UserIdentity;
|
|
use Wikimedia\Rdbms\IResultWrapper;
|
|
use Wikimedia\Rdbms\IDatabase;
|
|
|
|
/**
|
|
* Extension mechanism for WatchedItemQueryService
|
|
*
|
|
* @since 1.29
|
|
*
|
|
* @file
|
|
* @ingroup Watchlist
|
|
*
|
|
* @license GPL-2.0-or-later
|
|
*/
|
|
interface WatchedItemQueryServiceExtension {
|
|
|
|
/**
|
|
* Modify the WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
|
|
* query before it's made.
|
|
*
|
|
* @warning Any joins added *must* join on a unique key of the target table
|
|
* unless you really know what you're doing.
|
|
* @param UserIdentity $user
|
|
* @param array $options Options from
|
|
* WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
|
|
* @param IDatabase $db Database connection being used for the query
|
|
* @param array &$tables Tables for Database::select()
|
|
* @param array &$fields Fields for Database::select()
|
|
* @param array &$conds Conditions for Database::select()
|
|
* @param array &$dbOptions Options for Database::select()
|
|
* @param array &$joinConds Join conditions for Database::select()
|
|
*/
|
|
public function modifyWatchedItemsWithRCInfoQuery( UserIdentity $user, array $options,
|
|
IDatabase $db, array &$tables, array &$fields, array &$conds, array &$dbOptions,
|
|
array &$joinConds
|
|
);
|
|
|
|
/**
|
|
* Modify the results from WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
|
|
* before they're returned.
|
|
*
|
|
* @param UserIdentity $user
|
|
* @param array $options Options from
|
|
* WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
|
|
* @param IDatabase $db Database connection being used for the query
|
|
* @param array &$items array of pairs ( WatchedItem $watchedItem, string[] $recentChangeInfo ).
|
|
* May be truncated if necessary, in which case $startFrom must be updated.
|
|
* @param IResultWrapper|bool $res Database query result
|
|
* @param array|null &$startFrom Continuation value. If you truncate $items, set this to
|
|
* [ $recentChangeInfo['rc_timestamp'], $recentChangeInfo['rc_id'] ] from the first item
|
|
* removed.
|
|
*/
|
|
public function modifyWatchedItemsWithRCInfo( UserIdentity $user, array $options, IDatabase $db,
|
|
array &$items, $res, &$startFrom
|
|
);
|
|
|
|
}
|