- ApiQueryInfo
- ApiQueryUserInfo
- ApiQueryWatchlist
- ApiQueryWatchlistRaw
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | ifried | T8964 Watch pages for a few days only (add an expiry time) | |||
Resolved | MusikAnimal | T100508 Watchlist expiry: Watch pages for a specified time frame (2013) | |||
Open | None | T129478 Refactor watchlist related code to use WatchedItemStore | |||
Resolved | Addshore | T129482 Refactor watchlist related API classes to use WatchedItemStore | |||
Resolved | WMDE-leszek | T132565 [Task] Refactor database-related code out of ApiQueryWatchlist | |||
Resolved | WMDE-leszek | T132566 [Task] Refactor database-related code out of ApiQueryWatchlistRaw | |||
Resolved | Addshore | T134387 ApiSetNotificationTimestamp update watchlist wl_notificationtimestamp should use WatchedItemStore |
Event Timeline
The API has a very tangled use of the watchlist table (as in it is intertwined with many other things).
This will likely be hard to extract into the Store and may not happen (or may not happen until someone with a better knowledge of the API areas takes a look)
Change 266572 had a related patch set uploaded (by Addshore):
Move counting of watchers to WatchedItemStore
https://gerrit.wikimedia.org/r/266572
Change 276441 had a related patch set uploaded (by Addshore):
Add countUnreadNotifications to WatchedItemStore
https://gerrit.wikimedia.org/r/276441
It's not really that tangled. Your confusion mentioned on I2868c31f seems to be because ApiQueryBase uses various methods to manage the building of the $table, $vars, $conds, $options, and $join_conds parameters to be passed to Database::select():
- ApiQueryBase::addTables() appends to $tables.
- ApiQueryBase::addJoinConds() appends to $join_conds.
- ApiQueryBase::addFields() and ApiQueryBase::addFieldsIf() append to $vars.
- ApiQueryBase::addWhere(), ApiQueryBase::addWhereIf(), ApiQueryBase::addWhereField(), ApiQueryBase::addWhereRange(), and ApiQueryBase::addTimestampWhereRange() append to $where.
- ApiQueryBase::addOption(), ApiQueryBase::addWhereRange(), and ApiQueryBase::addTimestampWhereRange() append to $options.
The other bit of difficulty is probably due to the need for batch operations.
As for the modules themselves,
- ApiQueryInfo simply has batch versions of two queries made by InfoAction. You already did one in I5a465773.
- ApiQueryUserInfo is trivial, and you already did it in I91aa1094.
- ApiQueryWatchlist is basically the equivalent of Special:Watchlist, so this is about the same as T129481: Refactor SpecialPages for Watchlist to use WatchedItemStore.
- ApiQueryWatchlistRaw just dumps all the pages on the watchlist, optionally with or filtered by the nullity of the wl_notificationtimestamp field, not terribly different from a read-only version of Special:EditWatchlist/raw, which again is rather related to T129481: Refactor SpecialPages for Watchlist to use WatchedItemStore.
Change 277488 had a related patch set uploaded (by WMDE-leszek):
Add WatchedItemStore::countVisitingWatchersMultiple
https://gerrit.wikimedia.org/r/277488
Change 266572 merged by jenkins-bot:
Move counting of watchers to WatchedItemStore
https://gerrit.wikimedia.org/r/266572
Change 276441 merged by jenkins-bot:
Add countUnreadNotifications to WatchedItemStore
https://gerrit.wikimedia.org/r/276441
Change 277528 had a related patch set uploaded (by Addshore):
Fix ApiQueryInfo break from use of WatchedItemStore
https://gerrit.wikimedia.org/r/277528
Change 277528 merged by jenkins-bot:
Fix ApiQueryInfo break from use of WatchedItemStore
https://gerrit.wikimedia.org/r/277528
Change 277788 had a related patch set (by WMDE-leszek) published:
Fix ApiQueryInfo response for prop=watchers
https://gerrit.wikimedia.org/r/277788
Change 277788 merged by jenkins-bot:
Fix ApiQueryInfo response for prop=watchers
https://gerrit.wikimedia.org/r/277788
Change 277488 merged by jenkins-bot:
Add WatchedItemStore::countVisitingWatchersMultiple
https://gerrit.wikimedia.org/r/277488
Change 278283 had a related patch set uploaded (by WMDE-leszek):
Use WatchedItemStore in ApiQueryInfo::getWatchedInfo
https://gerrit.wikimedia.org/r/278283
Change 278283 merged by jenkins-bot:
Use WatchedItemStore in ApiQueryInfo::getWatchedInfo
https://gerrit.wikimedia.org/r/278283
Change 278859 had a related patch set uploaded (by WMDE-leszek):
Use WatchedItemStore::getWatchedItemsForUser in ApiQueryWatchlistRaw
https://gerrit.wikimedia.org/r/278859