Commit graph

19 commits

Author SHA1 Message Date
Amir Sarabadani 40c3c65ccf Switch from typehinting ILBFactory to IConnectionProvider
Narrower interface

Change-Id: Id94d098089f1db645ea6b4b4eb516a512c66fdb2
2023-04-29 23:00:59 +00:00
Bartosz Dziewoński 0d21df43dc Allow maintenance script to work even when DiscussionToolsEnablePermalinksBackend is off
Bug: T334258
Change-Id: I40e09b2f8561eeac1744bbbc48e3973e519bd9ea
2023-04-14 19:36:18 +02:00
Bartosz Dziewoński c0cb0bb24d Add a limit to queries on SpecialFindComment etc.
Some mass messages appear on hundreds or thousands of pages and it's
not good to try to list them all.

Change-Id: Ib903d67ba4fd9d85790ef4271933991b9b6f3834
2023-03-26 10:29:39 +00:00
Amir Sarabadani a1ee2d6daf Use the new method of getting database object
Bug: T326274
Change-Id: I40c6efee0d13ebb6f345ac9f13d243d730b146b9
2023-02-23 12:57:16 +01:00
Bartosz Dziewoński af68c835bb Update exception handling for new code conventions
Change code to match the documented consensus formed on T321683:
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Exception_handling

* Do not directly throw Exception, Error or MWException
* Document checked exceptions with @throws
* Do not document unchecked exceptions

For this extension, I think it makes sense to consider DOMException an
unchecked exception too (in addition to the usual LogicException and
RuntimeException).

Depends-On: Id07e301c3f20afa135e5469ee234a27354485652
Depends-On: I869af06896b9757af18488b916211c5a41a8c563
Depends-On: I42d9b7465d1406a22ef1b3f6d8de426c60c90e2c
Change-Id: Ic9d9efd031a87fa5a93143f714f0adb20f0dd956
2023-01-22 18:17:11 +00:00
Bartosz Dziewoński e72f58ca78 Remove some redundant PHPDoc comments
Inspired by this Wikitech-l discussion:
https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/NWXPNHRNLEVXHSWX33H473OAWQP6CDOA/

To keep this simple for now, I am only removing redundant PHPDoc
comments on constructors, and only when all the documentation for
parameters completely duplicates type hints.

More could be done, but that can happen later when we have better
tooling. Redundant comments on constructors that take a dozen services
are by far the most annoying for me and I want them gone now.

Change-Id: I86cbf7d6e48035cfa06f780c8fb1b02e68709a0c
2022-11-29 18:47:18 +00:00
Bartosz Dziewoński 08e1073f58 ThreadItemStore: Handle race conditions when finding/inserting outside of transaction
Bug: T322701
Change-Id: Icea63dd562c1812a372f3a947ba1244e72d07a16
2022-11-10 23:33:24 +00:00
Bartosz Dziewoński 759e6b757a ThreadItemStore: Fix setting parent IDs when parent already existed
Bug: T322599
Change-Id: I697de586fb3c1b1901f434f6fbef501cec3164df
2022-11-08 01:38:41 +01:00
jenkins-bot 98285f3b27 Merge "ThreadItemStore: Update existing rows if possible rather than insert+delete" 2022-11-03 14:12:49 +00:00
Bartosz Dziewoński c4c455c550 ThreadItemStore: Update existing rows if possible rather than insert+delete
Bug: T321121
Change-Id: I678b093aef95febb33cf4b0140b0625ef3241779
2022-11-03 00:53:19 +01:00
Bartosz Dziewoński 433e57394c Use PHP 7.4 property types
Change-Id: I788db64f0c0c00894d77256b7f016d44eda4bbb1
2022-10-28 21:56:38 +02:00
Bartosz Dziewoński 33f4006713 ThreadItemStore: Fix updates for identical revision timestamps
Use revision IDs to break the tie, consistently with MediaWiki (see
RevisionStore::getRelativeRevision) instead of assuming that the
revision we're processing now is somehow both older *and* newer than
the other one (the mind boggles how that ever made sense to me).

Change-Id: I9f1a07124301a36be68578d908353b72f0442c00
2022-10-20 02:37:47 +02:00
Bartosz Dziewoński 91aeaabe83 ThreadItemStore: Remove long comment no one is ever going to read
I should have just put that in a commit message rather than source code.

Change-Id: Ia5c06c91c21b0b5da1ed578369825a3870c48833
2022-10-20 01:49:19 +02:00
Bartosz Dziewoński 482a2c6dd0 ThreadItemStore: Move some work in insertThreadItems() outside transactions
As suggested in the discussion on T315353.

Bug: T317236
Bug: T317237
Change-Id: I8d9f2e3d4779a2e2f433a8fffea2767ae986bc48
2022-09-29 21:34:15 +02:00
Bartosz Dziewoński 14b01e101a Only hold on to a Config instead of ConfigFactory when injecting
The config is currently unused in some classes, but this is okay since
it might be used in the future.

Change-Id: Ie25fc52cc5d3476c9445e182975d229991316bd3
2022-09-03 00:39:51 +02:00
Bartosz Dziewoński c1442f8331 Replace deprecated database stuff
From in-person code review with Amir:
* getConnectionRef() has been deprecated in favor of getConnection()
* 'watchlist' query group no longer exists (T263127)
* Since this simplifies things, we can remove our wrapper methods

Change-Id: Ic610233b2e6d6ed68f7e1f5b31bb8996ed77f04b
2022-08-16 18:51:28 +00:00
Bartosz Dziewoński 4ffebd80f2 Add config option to enable/disable permalinks backend
From in-person code review with Amir: using tableExists() is a bad
idea, because the table might not consistently exists on all replicas.
It's better to have a config option despite the inconvenience.

Bug: T315353
Change-Id: I728759634c454c0dcbdc4603c15cab60415c7c03
2022-08-16 18:38:45 +00:00
Bartosz Dziewoński 4c17819a76 Migrate usage of Database::select (and friends) to SelectQueryBuilder
Bug: T312466
Change-Id: I99d4402d796421221a1c6c56ef88b023cb495833
2022-08-13 00:32:45 +02:00
Bartosz Dziewoński 0024a94ba7 Store permalink data, implement Special:FindComment/GoToComment
Depends-On: I90656cc74bb1cb1f2f3c82ad51cfb164cb8a4a4b
Bug: T296801
Change-Id: I84187b303aa10a242c872088403f808df3d1f940
2022-08-11 01:19:47 +02:00