WatchedItemQueryServiceExtension.php 2.0 KB

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