aboutsummaryrefslogtreecommitdiffstats
path: root/includes/watcheditem
Commit message (Collapse)AuthorAgeFilesLines
* Filter out expired items from watcher countshmonroy2020-05-191-21/+68
| | | | | | | | | | | | Filter out the expired items from: * Watcher counts in an article info page (Number of page watchers, Number of page watchers who visited recent edits). * Mediawiki API when getting the properties `watchers` and `visitingwatchers` for an article. Bug: T251327 Change-Id: I48489b685f8aec2c265b316c68e626ad5126b123
* Fix more PSR12.Properties.ConstantVisibility.NotFoundReedy2020-05-152-3/+3
| | | | Change-Id: I0ccda3d1de29b1044f74ef0972949eb8fbcb707d
* Add methods to check if a page is temporarily watchedMusikAnimal2020-05-133-0/+29
| | | | | | | Add 'mw-watchlink-temp' class to watch link when temporarily watched. Bug: T248495 Change-Id: I61b24fddf6aaf5233f426602bfa1cc4fafce942b
* Filter out expired items from Special:Watchlist pagehmonroy2020-04-271-5/+15
| | | | | | | | Add functionality to exclude all expired items from the watchlist results in the Special:Watchlist page. Bug: T245080 Change-Id: I49840a2527e553d99b8a42db34af207870d1e0fb
* docs: Hook interface doc comment reviewapaskulin2020-04-212-9/+14
| | | | | | | | Edited doc comments for hook interfaces to improve consistency and add type hints. Bug: T246855 Change-Id: I38fa802463cd6f39bf5946dbbeb1b3ebaea604b2
* Automatically generated hook interfacesTim Starling2020-04-202-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add hook interfaces which were generated by a script which parses hooks.txt and identifies caller namespaces and directories. Hook interfaces are mostly placed in a Hook/ subdirectory relative to the caller location. When there are callers in multiple directories, a "primary" caller was manually selected. The exceptions to this are: * The source root, maintenance and tests, which use includes/Hook. Test hooks need to be autoloadable in a non-test request so that implementing test interfaces in a generic handler will not fail. * resources uses includes/resourceloader/Hook * The following third-level subdirectories had their hooks placed in the parent ../Hook: * includes/filerepo/file * includes/search/searchwidgets * includes/specials/forms * includes/specials/helpers * includes/specials/pagers Parameters marked as legacy references in hooks.txt are passed by value in the interfaces. Bug: T240307 Change-Id: I6efe2e7dd1f0c6a3d0f4d100a4c34e41f8428720
* Merge "Add expiry type to ParamValidator"jenkins-bot2020-04-092-27/+2
|\
| * Add expiry type to ParamValidatorMusikAnimal2020-04-082-27/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit also changes ApiWatch to make use of the new parameter type. Other APIs will be updated to use it in a separate patch (T248196). In doing this, we are for the first using logic within a TypeDef outside the API. This seems acceptable given TypeDefs chiefly appear to serve as a validation method, with otherwise no particular logic tied to the concept of APIs. wfIsInfinity() now uses ExpiryDef::INFINITY_VALS Bug: T248508 Change-Id: If8f0df059eafb73ec9f39cc076b3a9ce2412d60a
* | Remove expired items in WatchedItemStore::clearUserWatchedItemshmonroy2020-04-081-5/+31
|/ | | | | | | | Add functionality to ClearUserWatchedItems function in WatchedItemStore to delete watchlist expired items from watchlist_expiry table. Bug: T249283 Change-Id: Ifb475c7b8e824419f45dea489940a15d9edb28c5
* Add check to api that filters out expired watchlist itemshmonroy2020-04-031-1/+19
| | | | | | | | Add logic to API module that outputs the watchlist (api.php?action=query&list=watchlist) to filter out expired watched items when $wgWatchlistExpiry feature flag is turned on. Bug: T247029 Change-Id: I49e7959b5166e74c95106a20d965dec6a0590a87
* Merge "Purge expired watchlist items"jenkins-bot2020-03-263-0/+121
|\
| * Purge expired watchlist itemsSam Wilson2020-03-263-0/+121
| | | | | | | | | | | | | | | | | | Add two methods to remove expired watchlist items: 1. A job that's triggered on about 10% of page edits; and 2. A new maintenance script. Bug: T244804 Change-Id: Ica8ab92837c38fa4d484726c94d5181c08387e28
* | ApiWatch: Add support for expiriesMusikAnimal2020-03-242-12/+30
|/ | | | | | | | | With this commit, the action=watch API accepts an 'expiry' parameter, analagous to the expiry accepted by action=userrights, action=block, etc. Bug: T245078 Change-Id: If37a772253082529cb290027da87098c1e6bf98c
* Add support for watchlist expiries to ↵Sam Wilson2020-03-131-3/+22
| | | | | | | | | WatchedItemQueryService::getWatchedItemsForUser() This method is only used by ApiQueryWatchlistRaw. Bug: T247026 Change-Id: I7852bea84c3310e01a9fa2b6fda658e89346980c
* Fixes for batch watchlist deletion and relative expiriesMusikAnimal2020-03-051-2/+2
| | | | | | Change-Id: I3902011b7c56cb0804754cc398a2b93778e73960 Follows-Up: Ifff5e56e0222bb325cf796e0aa3d88825820d1fd Bug: T245213
* Introduce an expiry to WatchedItemMusikAnimal2020-03-044-56/+291
| | | | | | | | | | | Includes the new $wgWatchlistExpiry feature flag. Consumers of WatchedItem and WatchedItemStore have not been changed to make use of expiries, this along with associated UI changes will be done in a separate patch. Bug: T245213 Change-Id: Ifff5e56e0222bb325cf796e0aa3d88825820d1fd
* When clearing don't load the watchlist if we must clear through a jobaddshore2020-01-293-1/+20
| | | | | | | | | | | | | | | It looks like this bug has existed in the special page since before the time of the refactoring into WatchedItemStore although apparently it has only just surfaced now! This adds a new method into WatchedItemStore that decides if the watchlist can be cleared interactively or must use the job queue. This can then be used in the special page instead of the old logic which would load the watchlist and then count the loaded items (inefficient if you know your clearing the list anyway) Bug: T243449 Change-Id: I810d89e3e1142a223430f7fc5f8598a493637a72
* Fix WatchedItemStoreInterface::clearUserWatchedItems commentsReedy2020-01-241-1/+1
| | | | Change-Id: I9b8cad9b0e3274252a0d0dc1db641b108e2804c7
* Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUseJames D. Forrester2020-01-101-1/+1
| | | | Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
* Set constant visibility, part 1Max Semenik2019-10-181-29/+29
| | | | Change-Id: I3dad26b1a0bd469fa84fee5c15d9b581765ceb94
* Fix new phan errors, part 4Daimona Eaytoy2019-10-121-1/+2
| | | | | | | Still doc-only, this ends the easy part. Bug: T231636 Change-Id: I51f180edc57d96322b9cd46e6a32aeffcbdc3bed
* Fix some phan warnings for too many params (part 1)Daimona Eaytoy2019-10-102-2/+3
| | | | | Bug: T231636 Change-Id: Ib0ca6bf2c426c21c4d42944c53a219e5940a5f11
* Make WatchedItemQueryService depend on PermissionManagerPetr Pchelko2019-09-161-7/+17
| | | | | Bug: T220191 Change-Id: I714d2b33b83dab230a8168765d5523cb14971371
* phan: Disable enable_class_alias_supportUmherirrender2019-09-151-1/+1
| | | | | | It is enabled for b/c in extensions, but not needed in core Change-Id: I51dca12be9c77049f77563d9bf0edd07928c2300
* watcheditem: Fix bad $options param in ↵Umherirrender2019-09-081-1/+4
| | | | | | | | | | | | NoWriteWatchedItemStore::countWatchersMultiple countVisitingWatchersMultiple is documented to take int|null as second parameter, but array is given here. The options array is documented to have a minimumWatchers key, so fix it by using that key. Caught by PhanTypeMismatchArgument, to be enabled with I34d65fe3ff191. Change-Id: I0271edae3442fc1adafabf623beeb7f2c4411d6c
* watchlist: cleanup WatchedItemStore PhpStorm warningsAaron Schulz2019-08-051-9/+4
| | | | Change-Id: I21bcc41781744f0fd323b8c46f4a71b4fc040eff
* Merge "Type hint against LinkTarget in WatchedItemStore"jenkins-bot2019-07-251-1/+1
|\
| * Type hint against LinkTarget in WatchedItemStoreUmherirrender2019-06-111-1/+1
| | | | | | | | | | | | | | | | | | Type hint against the interface LinkTarget, not the implemenation TitleValue The whole class is using the interface for type hinting, so this is more consistency Change-Id: Ic76926f077a731e4317dd3de6ed532b9fd8eb840
* | Avoid usage of deprecated Revision::* constants, use RevisionRecordDerick Alangi2019-07-211-2/+3
| | | | | | | | Change-Id: I872fc89e5c02dd6a3ae9cd7e76640b95dc33f514
* | WatchedItemStore: Fix fatal when revision is deletedRoan Kattouw2019-07-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | People following links from their watchlist emails to since-deleted revisions were getting fatals from WatchedItemStore::getNotificationTimestamp(). It's hard to tell whether returning null or false is the right thing to do here, because this function can return both and the difference is not documented, and I wasn't able to find any callers that care about the distinction. Bug: T226741 Change-Id: Ib2a836099343f4c161227266dbeeafbc76dccc2b
* | Fix types around ILoadBalancer and IResultWrapperUmherirrender2019-07-041-3/+3
|/ | | | Change-Id: I08531ccc6db046114f3535cfe6c108936dfff0d0
* Merge "watcheditem: Do not create the same TitleValue object twice"jenkins-bot2019-06-101-1/+1
|\
| * watcheditem: Do not create the same TitleValue object twiceUmherirrender2019-06-101-1/+1
| | | | | | | | | | | | Minor optimization in getWatchedItemsForUser(). Follows-up 7c12727fff0. Change-Id: I29f40f2c09c334eea33c7aaf351e1f1a93de9c13
* | Pass options as array to IDatabase::insertUmherirrender2019-06-071-1/+1
|/ | | | | | The documentation only allows arrays there Change-Id: I00c6e47a817a70bed9a443aebc675ef4c3d6b1e5
* WatchedItemStore::getWatchedItem returns a WatchedItemUmherirrender2019-06-061-2/+2
| | | | | Follow-Up: I31e983d7ac287158101b18ad95779d83537302a2 Change-Id: I4819d6e9f919467d46b3704331a54068a50c2cfa
* Merge "WatchedItemStore: Remove deprecated Title param to getNextRevision()"jenkins-bot2019-05-291-1/+1
|\
| * WatchedItemStore: Remove deprecated Title param to getNextRevision()Roan Kattouw2019-05-191-1/+1
| | | | | | | | | | | | | | | | This was deprecated in I76bc6fd6ee, but somehow this usage was missed, maybe the commit that added it went through review in parallel with that one. Change-Id: I8131f360f4300f62d56be64fda117038f51e693b
* | Make some array type hints more specificThiemo Kreuz2019-05-221-1/+1
|/ | | | Change-Id: Ia9ed6fa851316baa47e73d9a5988a863d15f298c
* watchlist: cleanup various method/variable names and comments in ↵Aaron Schulz2019-05-092-3/+14
| | | | | | watchlist/store code Change-Id: I70a55d5b4ea38f92132a15da3feb314b6b5bb013
* Merge "Consolidate duplicated unseen change logic and fix inconsistent code"jenkins-bot2019-05-061-1/+1
|\
| * Consolidate duplicated unseen change logic and fix inconsistent codeAaron Schulz2019-05-031-1/+1
| | | | | | | | | | Bug: T218511 Change-Id: I42387498dff0b1fc31f006ce3ba71241de9d45d7
* | Convert WatchedItem and friends to LinkTargetAryeh Gregor2019-05-063-56/+55
| | | | | | | | | | | | | | | | | | There is no longer any reference to Title in WatchedItem classes or their unit tests except for one hook that keeps Title for compat. Happy side effects include getting rid of $revisionGetTimestampFromIdCallback, and a net reduction of 143 LOC. Change-Id: Id998c6f336ed808f7259e4f8359bcf8d6c0210d6
* | Convert WatchedItem and friends to UserIdentityAryeh Gregor2019-05-056-139/+183
|/ | | | | | | | | | | | | | | | | | | I wasn't able to port some places that rely on isAllowed, getOption, or related methods. This adds isRegistered() to UserIdentity, which works like User::isLoggedIn() but with a better name. I also cleaned up User mocks in WatchedItemQueryServiceUnitTest in the course of debugging test failures when switching them to UserIdentityValue instead of mock Users where possible. They now specify explicitly which methods are allowed to be called on their User objects, which I believe is good practice for mocks (and unfortunately PHPUnit makes it awkward). Bug: T207972 Depends-On: I883d506197a011fe4c102b72df4d9deb58ab5ca2 Change-Id: Iadbf7bc31a496899dbef44e49065ff89f37aea89
* Merge "Improve documentation of constants throughout the codebase"jenkins-bot2019-04-121-3/+0
|\
| * Improve documentation of constants throughout the codebaseThiemo Kreuz2019-02-261-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most notable improvements I was able to fit into this patch can be seen in the User class, as well as in AbstractRestriction. Our documentation generator ignores the @const tag. It's not needed. Just have a comment above a constant and it will show up in the generated documentation. Using @var is misleading because a constant is not a "variable". The type of a constant is strictly derived from it's value. Documenting the type typically does not provide useful information. Doxygen does not understand the type, but ignores any @… tag and renders everything else as plain text. I can split this patch if you prefer. Please tell me. Change-Id: I8019ae45c049822cdc1768d895ea3e3216c6db5f
* | jobqueue: add GenericParameterJob and RunnableJob interfaceAaron Schulz2019-04-081-4/+3
| | | | | | | | | | | | | | | | | | | | Simplify the code of jobs that do not care about titles and removes the direct Title dependency from JobQueue. Remove getTitle() from IJobSpecification itself. Move all the Job::factory calls into a single JobQueue::factoryJob() method. Depends-on: Iee78f4baeca0c0b4d6db073f2fbcc56855114ab0 Change-Id: I9c9d0726d4066bb0aa937665847ad6042ade13ec
* | Collapse some nested if statementsReedy2019-04-041-5/+3
| | | | | | | | Change-Id: I9a97325d738d09370d29d35d5254bc0dadc57ff4
* | WatchedItemStore: Use batching in setNotificationTimestampsForUserRoan Kattouw2019-03-211-18/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update rows in batches, using the same logic as is used by removeWatchBatchForUser(). Also remove the functionality for updating all rows, and move that to resetAllNotificationTimestampsForUser() instead. To that end, add a timestamp parameter to that method and to the job it uses, and make setNotificationTimestampsForUser() behave like a backwards-compatibility wrapper around resetAllNotificationTimestampsForUser() when no list of titles is specified. Bug: T207941 Change-Id: I58342257395de6fcfb4c392b3945b12883ca1680 Follows-Up: I2008ff89c95fe6f66a3fd789d2cef0e8fe52bd93
* | Fix WatchedItemStore last-seen stashing logicAaron Schulz2019-03-141-5/+22
| | | | | | | | | | | | | | | | | | | | | | This should be the "last revision seen" timestamp, which is different than the "first revision not seen" timestamp in the DB. Also make sure that SpecialWatchlist accounts for the stash values. Relatedly, better document the callback usage in BagOStuff::merge(). Change-Id: I98b03a5cd40fec5b4a2633d499ff77079d264e3c
* | Merge "Stash WatchedItem changes so that the jobs run from the queue"jenkins-bot2019-03-065-35/+150
|\ \