WatchedItemQueryServiceExtension.php 2.1 KB

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