MediaWiki  master
WatchedItemQueryService Class Reference
Collaboration diagram for WatchedItemQueryService:

Public Member Functions

 __construct (LoadBalancer $loadBalancer, CommentStore $commentStore, ActorMigration $actorMigration, WatchedItemStoreInterface $watchedItemStore)
 
 getWatchedItemsForUser (UserIdentity $user, array $options=[])
 For simple listing of user's watchlist items, see WatchedItemStore::getWatchedItemsForUser. More...
 
 getWatchedItemsWithRecentChangeInfo (User $user, array $options=[], &$startFrom=null)
 

Public Attributes

const DIR_NEWER = 'newer'
 
const DIR_OLDER = 'older'
 
const FILTER_ANON = 'anon'
 
const FILTER_AUTOPATROLLED = 'autopatrolled'
 
const FILTER_BOT = 'bot'
 
const FILTER_CHANGED = 'changed'
 
const FILTER_MINOR = 'minor'
 
const FILTER_NOT_ANON = '!anon'
 
const FILTER_NOT_AUTOPATROLLED = '!autopatrolled'
 
const FILTER_NOT_BOT = '!bot'
 
const FILTER_NOT_CHANGED = '!changed'
 
const FILTER_NOT_MINOR = '!minor'
 
const FILTER_NOT_PATROLLED = '!patrolled'
 
const FILTER_NOT_UNREAD = '!unread'
 
const FILTER_PATROLLED = 'patrolled'
 
const FILTER_UNREAD = 'unread'
 
const INCLUDE_AUTOPATROL_INFO = 'autopatrol'
 
const INCLUDE_COMMENT = 'comment'
 
const INCLUDE_FLAGS = 'flags'
 
const INCLUDE_LOG_INFO = 'loginfo'
 
const INCLUDE_PATROL_INFO = 'patrol'
 
const INCLUDE_SIZES = 'sizes'
 
const INCLUDE_TAGS = 'tags'
 
const INCLUDE_USER = 'user'
 
const INCLUDE_USER_ID = 'userid'
 
const SORT_ASC = 'ASC'
 
const SORT_DESC = 'DESC'
 

Private Member Functions

 getConnection ()
 
 getExtensions ()
 
 getExtraDeletedPageLogEntryRelatedCond (IDatabase $db, User $user)
 
 getFromUntilTargetConds (IDatabase $db, LinkTarget $target, $op)
 Creates a query condition part for getting only items before or after the given link target (while ordering using $sort mode) More...
 
 getRecentChangeFieldsFromRow (stdClass $row)
 
 getStartEndConds (IDatabase $db, array $options)
 
 getStartFromConds (IDatabase $db, array $options, array $startFrom)
 
 getUserRelatedConds (IDatabase $db, User $user, array $options)
 
 getWatchedItemsForUserQueryConds (IDatabase $db, UserIdentity $user, array $options)
 
 getWatchedItemsForUserQueryDbOptions (array $options)
 
 getWatchedItemsWithRCInfoQueryConds (IDatabase $db, User $user, array $options)
 
 getWatchedItemsWithRCInfoQueryDbOptions (array $options)
 
 getWatchedItemsWithRCInfoQueryFields (array $options)
 
 getWatchedItemsWithRCInfoQueryFilterConds (User $user, array $options)
 
 getWatchedItemsWithRCInfoQueryJoinConds (array $options)
 
 getWatchedItemsWithRCInfoQueryTables (array $options)
 
 getWatchlistOwnerId (UserIdentity $user, array $options)
 

Private Attributes

ActorMigration $actorMigration
 
CommentStore $commentStore
 
WatchedItemQueryServiceExtension [] null $extensions = null
 
LoadBalancer $loadBalancer
 
WatchedItemStoreInterface $watchedItemStore
 

Detailed Description

Definition at line 19 of file WatchedItemQueryService.php.

Constructor & Destructor Documentation

◆ __construct()

WatchedItemQueryService::__construct ( LoadBalancer  $loadBalancer,
CommentStore  $commentStore,
ActorMigration  $actorMigration,
WatchedItemStoreInterface  $watchedItemStore 
)

Member Function Documentation

◆ getConnection()

WatchedItemQueryService::getConnection ( )
private
Returns
IDatabase

Definition at line 98 of file WatchedItemQueryService.php.

References DB_REPLICA.

Referenced by getWatchedItemsForUser(), and getWatchedItemsWithRecentChangeInfo().

◆ getExtensions()

WatchedItemQueryService::getExtensions ( )
private

◆ getExtraDeletedPageLogEntryRelatedCond()

WatchedItemQueryService::getExtraDeletedPageLogEntryRelatedCond ( IDatabase  $db,
User  $user 
)
private

◆ getFromUntilTargetConds()

WatchedItemQueryService::getFromUntilTargetConds ( IDatabase  $db,
LinkTarget  $target,
  $op 
)
private

Creates a query condition part for getting only items before or after the given link target (while ordering using $sort mode)

Parameters
IDatabase$db
LinkTarget$target
string$opcomparison operator to use in the conditions
Returns
string

Definition at line 659 of file WatchedItemQueryService.php.

References Wikimedia\Rdbms\IDatabase\addQuotes(), MediaWiki\Linker\LinkTarget\getDBkey(), MediaWiki\Linker\LinkTarget\getNamespace(), LIST_AND, LIST_OR, and Wikimedia\Rdbms\IDatabase\makeList().

Referenced by getWatchedItemsForUserQueryConds().

◆ getRecentChangeFieldsFromRow()

WatchedItemQueryService::getRecentChangeFieldsFromRow ( stdClass  $row)
private

Definition at line 333 of file WatchedItemQueryService.php.

Referenced by getWatchedItemsWithRecentChangeInfo().

◆ getStartEndConds()

WatchedItemQueryService::getStartEndConds ( IDatabase  $db,
array  $options 
)
private

◆ getStartFromConds()

WatchedItemQueryService::getStartFromConds ( IDatabase  $db,
array  $options,
array  $startFrom 
)
private

◆ getUserRelatedConds()

WatchedItemQueryService::getUserRelatedConds ( IDatabase  $db,
User  $user,
array  $options 
)
private

◆ getWatchedItemsForUser()

WatchedItemQueryService::getWatchedItemsForUser ( UserIdentity  $user,
array  $options = [] 
)

For simple listing of user's watchlist items, see WatchedItemStore::getWatchedItemsForUser.

Parameters
UserIdentity$user
array$optionsAllowed keys: 'sort' => string optional sorting by namespace ID and title one of the self::SORT_* constants 'namespaceIds' => int[] optional namespace IDs to filter by (defaults to all namespaces) 'limit' => int maximum number of items to return 'filter' => string optional filter, one of the self::FILTER_* contants 'from' => LinkTarget requires 'sort' key, only return items starting from those related to the link target 'until' => LinkTarget requires 'sort' key, only return items until those related to the link target 'startFrom' => LinkTarget requires 'sort' key, only return items starting from those related to the link target, allows to skip some link targets specified using the form option
Returns
WatchedItem[]

Definition at line 276 of file WatchedItemQueryService.php.

References $options, $res, as, getConnection(), getWatchedItemsForUserQueryConds(), getWatchedItemsForUserQueryDbOptions(), and MediaWiki\User\UserIdentity\isRegistered().

◆ getWatchedItemsForUserQueryConds()

WatchedItemQueryService::getWatchedItemsForUserQueryConds ( IDatabase  $db,
UserIdentity  $user,
array  $options 
)
private

◆ getWatchedItemsForUserQueryDbOptions()

WatchedItemQueryService::getWatchedItemsForUserQueryDbOptions ( array  $options)
private

Definition at line 690 of file WatchedItemQueryService.php.

Referenced by getWatchedItemsForUser().

◆ getWatchedItemsWithRCInfoQueryConds()

◆ getWatchedItemsWithRCInfoQueryDbOptions()

WatchedItemQueryService::getWatchedItemsWithRCInfoQueryDbOptions ( array  $options)
private

Definition at line 675 of file WatchedItemQueryService.php.

References $sort.

Referenced by getWatchedItemsWithRecentChangeInfo().

◆ getWatchedItemsWithRCInfoQueryFields()

WatchedItemQueryService::getWatchedItemsWithRCInfoQueryFields ( array  $options)
private

◆ getWatchedItemsWithRCInfoQueryFilterConds()

WatchedItemQueryService::getWatchedItemsWithRCInfoQueryFilterConds ( User  $user,
array  $options 
)
private

◆ getWatchedItemsWithRCInfoQueryJoinConds()

WatchedItemQueryService::getWatchedItemsWithRCInfoQueryJoinConds ( array  $options)
private

Definition at line 707 of file WatchedItemQueryService.php.

Referenced by getWatchedItemsWithRecentChangeInfo().

◆ getWatchedItemsWithRCInfoQueryTables()

WatchedItemQueryService::getWatchedItemsWithRCInfoQueryTables ( array  $options)
private

Definition at line 346 of file WatchedItemQueryService.php.

References $tables.

Referenced by getWatchedItemsWithRecentChangeInfo().

◆ getWatchedItemsWithRecentChangeInfo()

WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo ( User  $user,
array  $options = [],
$startFrom = null 
)
Parameters
User$user
array$optionsAllowed keys: 'includeFields' => string[] RecentChange fields to be included in the result, self::INCLUDE_* constants should be used 'filters' => string[] optional filters to narrow down resulted items 'namespaceIds' => int[] optional namespace IDs to filter by (defaults to all namespaces) 'allRevisions' => bool return multiple revisions of the same page if true, only the most recent if false (default) 'rcTypes' => int[] which types of RecentChanges to include (defaults to all types), allowed values: RC_EDIT, RC_NEW, RC_LOG, RC_EXTERNAL, RC_CATEGORIZE 'onlyByUser' => string only list changes by a specified user 'notByUser' => string do not incluide changes by a specified user 'dir' => string in which direction to enumerate, accepted values:
  • DIR_OLDER list newest first
  • DIR_NEWER list oldest first 'start' => string (format accepted by wfTimestamp) requires 'dir' option, timestamp to start enumerating from 'end' => string (format accepted by wfTimestamp) requires 'dir' option, timestamp to end enumerating 'watchlistOwner' => User user whose watchlist items should be listed if different than the one specified with $user param, requires 'watchlistOwnerToken' option 'watchlistOwnerToken' => string a watchlist token used to access another user's watchlist, used with 'watchlistOwnerToken' option 'limit' => int maximum numbers of items to return 'usedInGenerator' => bool include only RecentChange id field required by the generator ('rc_cur_id' or 'rc_this_oldid') if true, or all id fields ('rc_cur_id', 'rc_this_oldid', 'rc_last_oldid') if false (default)
array | null&$startFromContinuation value: [ string $rcTimestamp, int $rcId ]
Returns
array[] Array of pairs ( WatchedItem $watchedItem, string[] $recentChangeInfo ), where $recentChangeInfo contains the following keys:
  • 'rc_id',
  • 'rc_namespace',
  • 'rc_title',
  • 'rc_timestamp',
  • 'rc_type',
  • 'rc_deleted', Additional keys could be added by specifying the 'includeFields' option

Definition at line 145 of file WatchedItemQueryService.php.

References $options, $res, $tables, as, class, false, getConnection(), getExtensions(), getRecentChangeFieldsFromRow(), getStartFromConds(), getWatchedItemsWithRCInfoQueryConds(), getWatchedItemsWithRCInfoQueryDbOptions(), getWatchedItemsWithRCInfoQueryFields(), getWatchedItemsWithRCInfoQueryJoinConds(), getWatchedItemsWithRCInfoQueryTables(), null, RC_CATEGORIZE, RC_EDIT, RC_EXTERNAL, RC_LOG, and RC_NEW.

◆ getWatchlistOwnerId()

WatchedItemQueryService::getWatchlistOwnerId ( UserIdentity  $user,
array  $options 
)
private

Member Data Documentation

◆ $actorMigration

ActorMigration WatchedItemQueryService::$actorMigration
private

Definition at line 67 of file WatchedItemQueryService.php.

Referenced by __construct().

◆ $commentStore

CommentStore WatchedItemQueryService::$commentStore
private

Definition at line 64 of file WatchedItemQueryService.php.

Referenced by __construct().

◆ $extensions

WatchedItemQueryServiceExtension [] null WatchedItemQueryService::$extensions = null
private

Definition at line 61 of file WatchedItemQueryService.php.

Referenced by getExtensions().

◆ $loadBalancer

LoadBalancer WatchedItemQueryService::$loadBalancer
private

Definition at line 58 of file WatchedItemQueryService.php.

Referenced by __construct().

◆ $watchedItemStore

WatchedItemStoreInterface WatchedItemQueryService::$watchedItemStore
private

Definition at line 70 of file WatchedItemQueryService.php.

Referenced by __construct().

◆ DIR_NEWER

const WatchedItemQueryService::DIR_NEWER = 'newer'

◆ DIR_OLDER

◆ FILTER_ANON

◆ FILTER_AUTOPATROLLED

const WatchedItemQueryService::FILTER_AUTOPATROLLED = 'autopatrolled'

◆ FILTER_BOT

◆ FILTER_CHANGED

◆ FILTER_MINOR

◆ FILTER_NOT_ANON

◆ FILTER_NOT_AUTOPATROLLED

const WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED = '!autopatrolled'

◆ FILTER_NOT_BOT

◆ FILTER_NOT_CHANGED

◆ FILTER_NOT_MINOR

◆ FILTER_NOT_PATROLLED

◆ FILTER_NOT_UNREAD

◆ FILTER_PATROLLED

◆ FILTER_UNREAD

◆ INCLUDE_AUTOPATROL_INFO

const WatchedItemQueryService::INCLUDE_AUTOPATROL_INFO = 'autopatrol'

Definition at line 29 of file WatchedItemQueryService.php.

Referenced by ApiQueryWatchlist\getFieldsToInclude().

◆ INCLUDE_COMMENT

const WatchedItemQueryService::INCLUDE_COMMENT = 'comment'

◆ INCLUDE_FLAGS

const WatchedItemQueryService::INCLUDE_FLAGS = 'flags'

◆ INCLUDE_LOG_INFO

const WatchedItemQueryService::INCLUDE_LOG_INFO = 'loginfo'

◆ INCLUDE_PATROL_INFO

const WatchedItemQueryService::INCLUDE_PATROL_INFO = 'patrol'

◆ INCLUDE_SIZES

const WatchedItemQueryService::INCLUDE_SIZES = 'sizes'

◆ INCLUDE_TAGS

const WatchedItemQueryService::INCLUDE_TAGS = 'tags'

Definition at line 32 of file WatchedItemQueryService.php.

Referenced by ApiQueryWatchlist\getFieldsToInclude().

◆ INCLUDE_USER

◆ INCLUDE_USER_ID

const WatchedItemQueryService::INCLUDE_USER_ID = 'userid'

◆ SORT_ASC

◆ SORT_DESC


The documentation for this class was generated from the following file: