Commit graph

23 commits

Author SHA1 Message Date
thiemowmde 0cf68818a8 Add various, more specific type hints
* Add @var comments to untyped getService() calls so IDEs and tools
  are able to understand where the callers are.
* Use the more specific IReadableDatabase where possible.
* Fix missing import.

Change-Id: I9c1153cb9fe872227753628a947f40bd5ee447fa
2023-06-09 13:44:42 +02:00
Bartosz Dziewoński eede5f73de NewTopicOptOutActiveUsers: Skip bot users etc.
Bug: T317375
Change-Id: I7b83d1b0a9c450ae5eefa5b6f7ebd9ef4c1f22a1
2023-05-17 17:33:39 +02:00
Bartosz Dziewoński 18edf9ca61 Define $maintClass in maintenance script for compatibility
Bug: T317375
Change-Id: Iad131b1fd7d8ae7e6ea6e01d907dcdbeffd8e4fe
2023-05-17 12:55:27 +02:00
Bartosz Dziewoński 2321e645f4 Add maint script to opt out active users from the new topic tool
Opt out users who are active (according to Special:ActiveUsers)
and have at least 100 edits, unless they have already opted in
by enabling the beta feature.

To run the script, use the new run.php wrapper:

  php maintenance/run.php MediaWiki.Extension.DiscussionTools.Maintenance.NewTopicOptOutActiveUsers

Bug: T317375
Change-Id: I953c4c9d00a60b00a621049b119ba96c9682004d
2023-05-05 18:51:38 +02:00
jenkins-bot 12abc51940 Merge "resources: Use core's manageForeignResources script now we can" 2023-04-25 19:09:28 +00:00
James D. Forrester a8a645e9e4 resources: Use core's manageForeignResources script now we can
Depends-On: I5df95ea4799d0efce60b58a35cb916c8e0f555b0
Change-Id: If6b323a46ec8eff1b908b4524b48527913a6f343
2023-04-25 14:46:16 -04:00
Bartosz Dziewoński c0269e701c Allow maintenance script to only process pages touched in a time period
Bug: T334258
Change-Id: Iba5509c55d3eb0ab7b9500eebd8d68fe82bfda1d
2023-04-14 19:44:01 +02: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 174533e41d persistRevisionThreadItems: Allow processing all pages in a namespace
Bug: T332745
Change-Id: I3014c9aab1df5aff6fe36742daef77b3b21a2445
2023-03-21 23:48:52 +01:00
Bartosz Dziewoński 445b8caca0 persistRevisionThreadItems: Avoid listing non-discussion pages
Bug: T329627
Change-Id: I52a9f5dfa583d8dc2e0a315844a2a40e538f6a8c
2023-02-14 17:53:27 +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
daniel a6a12730fc Don't write to parser cache from maintenance script
The parser cache for parsoid output isn't yet ready for full load.
Don't flood it when running batch operations.

Change-Id: I77f3de30b0500f0e5c593f4d31dceef7720f848e
2022-12-13 16:26:03 +00:00
Bartosz Dziewoński 7b5a8cea11 persistRevisionThreadItems: Print time taken
Change-Id: Ide002b26740815ef0db3351a0e7e8c498010d164
2022-11-09 00:18:42 +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 3fa61ab6cd Rewrite persistRevisionThreadItems
* Fix estimate when using --current
* Add waitForReplication() after batches
* Add an option to restart from a specific point
* Remove TableCleanup, which doesn't work well for these use cases
* Use index on page_id when processing current revisions only

Bug: T315510
Change-Id: Idf9759743e67b3e116d6e20234b603bd76d4a41f
2022-09-30 18:07:39 +02:00
Timo Tijhof 86d47438d3 maintenance: Use standard doMaintenance boilerplate
Consistent with core, most WMF extensions, and boilerplate as
documented in extensions/README and elsewhere; as per T316722.

Change-Id: I02cfcb2bd3debf877d1cbf8654dff4a98dd354ad
2022-09-30 18:01:57 +02:00
Bartosz Dziewoński 1cdb3df12a Fix boilerplate in maintenance scripts for WMF production
We run MediaWiki from directories like "php-1.39.0-wmf.26",
whose names include dots, making these scripts impossible to run.

Bug: T316548
Change-Id: Ic318939cea6eafb1a0cd3105517e45c9fca52f4b
2022-08-29 14:14:09 +00:00
Bartosz Dziewoński fd3453d96c persistRevisionThreadItems: Allow processing current revisions only
Bug: T315510
Change-Id: Iecde2a0a74a08b938ad0a089ed6d69662a8f28b1
2022-08-23 01:51:00 +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
David Lynch d543e7a4f9 Defensive use of dynamic paths in maintenance script
Bug: T242134
Change-Id: I64fc136d3d19268008062dc8a2c655c8551244ea
2020-02-20 19:51:07 +01:00
Umherirrender fdd52762ee Call Maintenance::requireExtension
This avoids that the script is executed without the extension is
installed.
This avoids than an error when class is missing

Change-Id: I064d2be5dbaa3b43c8134e19694511398decba88
2020-01-13 22:15:43 +01:00
Umherirrender 1c05fa9049 build: Add missing .phpcs.xml and make pass
Add .phpcs.xml to run codesniffer against the extension.
The entry in composer.json is already there

Change-Id: If9de7e9b1b9439dc4d5fa2ba521883d13deaa739
2020-01-13 20:48:11 +01:00
Bartosz Dziewoński db80e48933 Handle timestamps in daylight saving time
Add the Moment Timezone library. Add a script for managing libraries,
like in MediaWiki core.

Depends-On: I9a59a6ad01850b30327e4215f2be61b8d1c41277
Change-Id: I64bc79e7d0ccdf42b006e5a225c8aa70ea5f4e15
2019-10-22 16:33:21 +02:00