| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Watchlist; |
| 4 | |
| 5 | use MediaWiki\User\UserIdentity; |
| 6 | use Wikimedia\Rdbms\IReadableDatabase; |
| 7 | use Wikimedia\Rdbms\IResultWrapper; |
| 8 | |
| 9 | /** |
| 10 | * Extension mechanism for WatchedItemQueryService |
| 11 | * |
| 12 | * @since 1.29 |
| 13 | * |
| 14 | * @file |
| 15 | * @ingroup Watchlist |
| 16 | * |
| 17 | * @license GPL-2.0-or-later |
| 18 | */ |
| 19 | interface WatchedItemQueryServiceExtension { |
| 20 | |
| 21 | /** |
| 22 | * Modify the WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo() |
| 23 | * query before it's made. |
| 24 | * |
| 25 | * @warning Any joins added *must* join on a unique key of the target table |
| 26 | * unless you really know what you're doing. |
| 27 | * @param UserIdentity $user |
| 28 | * @param array $options Options from |
| 29 | * WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo() |
| 30 | * @param IReadableDatabase $db Database connection being used for the query |
| 31 | * @param array &$tables Tables for Database::select() |
| 32 | * @param array &$fields Fields for Database::select() |
| 33 | * @param array &$conds Conditions for Database::select() |
| 34 | * @param array &$dbOptions Options for Database::select() |
| 35 | * @param array &$joinConds Join conditions for Database::select() |
| 36 | */ |
| 37 | public function modifyWatchedItemsWithRCInfoQuery( UserIdentity $user, array $options, |
| 38 | IReadableDatabase $db, array &$tables, array &$fields, array &$conds, array &$dbOptions, |
| 39 | array &$joinConds |
| 40 | ); |
| 41 | |
| 42 | /** |
| 43 | * Modify the results from WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo() |
| 44 | * before they're returned. |
| 45 | * |
| 46 | * @param UserIdentity $user |
| 47 | * @param array $options Options from |
| 48 | * WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo() |
| 49 | * @param IReadableDatabase $db Database connection being used for the query |
| 50 | * @param array &$items array of pairs ( WatchedItem $watchedItem, string[] $recentChangeInfo ). |
| 51 | * May be truncated if necessary, in which case $startFrom must be updated. |
| 52 | * @param IResultWrapper|bool $res Database query result |
| 53 | * @param array|null &$startFrom Continuation value. If you truncate $items, set this to |
| 54 | * [ $recentChangeInfo['rc_timestamp'], $recentChangeInfo['rc_id'] ] from the first item |
| 55 | * removed. |
| 56 | */ |
| 57 | public function modifyWatchedItemsWithRCInfo( UserIdentity $user, array $options, IReadableDatabase $db, |
| 58 | array &$items, $res, &$startFrom |
| 59 | ); |
| 60 | |
| 61 | } |
| 62 | /** @deprecated class alias since 1.43 */ |
| 63 | class_alias( WatchedItemQueryServiceExtension::class, 'WatchedItemQueryServiceExtension' ); |