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