Commit graph

1552 commits

Author SHA1 Message Date
jenkins-bot 66c80eba34 Merge "Unsets icon correctly" 2023-11-13 20:51:55 +00:00
Jon Robson a3d2f9827e Unsets icon correctly
Fixes the rendering of an empty icon in Vector 2022
(empty string is a valid icon - blank icon)

Bug: T350195
Change-Id: I7b19d7e1e85eddd5a4bac29008cd53f14d640a08
2023-11-13 11:18:07 -08:00
Ed Sanders 2e6c50a963 Document some generated messages
Change-Id: I75571da5943bb94f6d997ebdb8e33fae8b62e812
2023-11-02 19:02:16 +00:00
Umherirrender e793977f23 Add some newlines to multiline statements in Hooks.php
Change-Id: I6c26dcb2dcdb345f74a14d859faa0b09fed4e0d4
2023-10-29 15:56:29 +01:00
Siddharth VP 0d071e2a7b Avoid use of globals for reading config in hooks
Change-Id: I6d476773397438d7c78e1869e2afe3699ce4c092
2023-10-29 15:41:21 +05:30
Umherirrender bdbd65ffae Replace empty() with falsy check
empty() should only be used to suppress errors
Found by a new phan plugin (T234237)

Change-Id: I3a2c86e0f83ec49cbd6af3ad30ecd0a663b761a0
2023-10-22 11:12:41 +02:00
Umherirrender ceb2da0f60 Replace empty() with falsy check
empty() should only be used to suppress errors
When the type of the variable is array,
a falsy check is the same (checks for null, false and empty array)
Found by a new phan plugin (T234237)

Change-Id: Ia4e25651d753b7b4d3bcd780123c66c3d90cdf1b
2023-10-21 20:56:18 +02:00
Siddharth VP 035f39d76c Use dependency injection in hooks
Removal of globals for reading config to be done in a follow-up patch

Change-Id: I8652ca67375ce2f2d79de93e0a3b75ac998131e0
2023-10-14 23:44:57 +05:30
jenkins-bot a8d425ef5b Merge "Use OutputPage::setPageTitleMsg() instead of ::setPageTitle()" 2023-09-21 21:00:58 +00:00
jenkins-bot 2a7427630f Merge "ForeignWikiRequest: Ensure fetching CSRF tokens uses unique CentralAuth tokens" 2023-09-20 15:58:11 +00:00
jenkins-bot 8114ac1c6b Merge "ForeignWikiRequest: Specify formatversion, errorformat" 2023-09-20 15:56:26 +00:00
Umherirrender 5e49d52fba Call hook handler for own hooks directly and not via hook system
Extensions should not a consumer of its own hooks,
just call the code before calling the hook.
In case of EchoGetBundleRules each extension should only handle it's
own event, so this is not a breaking change.
In case if EchoAbortEmailNotification the return false in the hook
handler already aborted further hooks, so this is not a breaking change.

Change-Id: I2715aa6499d01a1c1b3a27ff510b331eae0deca9
2023-09-08 16:47:33 +00:00
Bartosz Dziewoński 18ed307c39 ForeignWikiRequest: Ensure fetching CSRF tokens uses unique CentralAuth tokens
getCsrfToken() previously did the requests to every wiki with the same
'centralauthtoken'. Luckily this wasn't causing any bugs in practice,
because all users of ForeignWikiRequest that need CSRF tokens always
use it with a single wiki.

Change-Id: Ib1c0b9c13a34e38f85faed519c46cabd3b77e61e
2023-09-04 23:39:40 +02:00
Bartosz Dziewoński c3c3aed4dc ForeignWikiRequest: Specify formatversion, errorformat
Otherwise the parameters are copied from the local API request.
That mostly works fine, but browsing the errors logged for T342201
is a bit confusing when they're in different formats.

Change-Id: I5c361d6c0f7d635d3063290dec25f18bc6417e08
2023-09-04 23:39:30 +02:00
jenkins-bot 68d90d69a7 Merge "Make DB tests more robust" 2023-09-01 13:33:23 +00:00
jenkins-bot 697ca08827 Merge "EchoEventPresentationModel: Use userTemporary for temp accounts" 2023-08-30 10:56:01 +00:00
Sam Smith f4765cdd25 Decommission Echo* instruments
Completely remove the EchoMail and EchoInteraction instruments,
supporting code, and config variables.  Note well that the
EchoEventLoggingSchemas config included an entry for the
already-decommissioned Echo instrument so remove that too.

Bug: T344167
Change-Id: Ic0c44737d2c4a78ec19e67b8b8cd4e6cfb8e14fa
2023-08-29 11:27:15 +01:00
Daimona Eaytoy 7b1a9582b2 Make DB tests more robust
In EventMapperTest, suppress notifications created by calling
getExistingTestPage. So far, this test only worked because the existing
test page is created in addCoreDBData (and not inside the test), but
this will no longer be the case after core change
I308617427309815062d54c14f3438cab31b08a73. Clear the PageSaveComplete
hook handlers to prevent that.

DiscussionParser has a static cache of revision data that can become
stale when data is deleted between tests (because revision IDs can be
reassigned to different pages, similar to T344124). This cache seems
needed, and converting the class to a service seems hard, so add the
page title to the cache key to try and avoid collisions. This can still
break if two tests are using the same page, which is hopefully quite
unlikely.

Change-Id: Ic4cbd8ff424e1260544ff9754e0c89dd4bb2f733
2023-08-19 19:59:51 +00:00
gerritbot 84e0d10abd Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I19ff201e3a109d5f6b755c6c0857f7b22d08d26d
2023-08-19 16:43:18 +02:00
Amir Sarabadani 12a5a48892 Fix phpcs error
Change-Id: I6ac134c280e4e36b3935f9b095d26400ba27d2af
2023-08-19 04:53:14 +02:00
Reedy 8f44150300 And a few more namespaced classes...
Change-Id: I57b56d285bac4b41e81f656f3c1ddceee4620fb5
2023-08-18 22:27:18 +01:00
Reedy b003945c34 Namespace a few more classes
Change-Id: Ie233a4c8291432da3bd25d29337db52a2e97b540
2023-08-18 21:48:15 +01:00
Reedy e576cbdca0 Namespace some more classes
Change-Id: If1405788a4adb550e8a7e8c58b0c2c55cf10ea67
2023-08-18 21:24:59 +01:00
Reedy 1bc5b6daf8 Namespace classes that need aliases
Change-Id: Ieeeaf80d04b060d6dbca1959d5e66f4c69c5a7f2
2023-08-18 19:00:41 +01:00
Martin Urbanec 84a32adb92 EchoEventPresentationModel: Use userTemporary for temp accounts
Bug: T338912
Change-Id: Id4c7dc1506f2f5e4981a19664061503ccb9d802f
2023-08-18 10:31:38 +02:00
Ed Sanders e34220d984 Use shorthand array syntax in comment blocks
Change-Id: Ic5785a473f6db8c0f7ef6aae8260c61f78a07304
2023-08-16 18:12:07 +01:00
Umherirrender 8218e2aa23 Use HookHandlers for UserMerge hook
Bug: T315938
Depends-On: Ib78dae49854863af1a37a00636737c94694776ae
Change-Id: I948ef262b9c6f546244e64a62775068bfce79b69
2023-08-16 05:30:19 +00:00
jenkins-bot 078788f411 Merge "Create HookRunner class and the hook handler interfaces" 2023-08-16 05:26:06 +00:00
Umherirrender 63efbc5fd1 Use HookHandlers for remaining core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T315938
Change-Id: I84027e2899b4a013b78fe4e95f191f1e4c89b5f8
2023-08-16 09:19:22 +08:00
Daimona Eaytoy ef50bfeda5 Make Title and Revision caches proper services
Singletons are bad, amongst other reasons, because they're never reset
in tests. They can therefore occasionally cause test failures if the
cached data stored in one of these singletons becomes stale.

As noted on the task, ideally these two classes shouldn't exist at all,
and core should be responsible for caching the information it deems
expensive to compute.

As a temporary (TM) workaround, make both classes actual services, so
that the setUp/tearDown logic in MediaWikiIntegrationTestCase can
properly reset them between tests.

Dependencies are intentionally not being injected, precisely because
these classes should just be deleted, not improved.

Bug: T344124
Change-Id: I58b8d9610f9447468235b94d25732528ab6acce6
2023-08-14 17:41:23 +02:00
C. Scott Ananian 26aeebd301 Use OutputPage::setPageTitleMsg() instead of ::setPageTitle()
Bug: T343994
Depends-On: I384a12bdb66dfc8fa6650e76e27c671fae5163d6
Change-Id: I1464c9f7db3b30ad9bb12377cc39cfcd5d540f78
2023-08-10 16:28:23 -04:00
Umherirrender e52a792060 Create HookRunner class and the hook handler interfaces
Bug: T315938
Change-Id: Iffa2b409502b4269c9746e0304feb4aaee37a86e
2023-08-06 10:30:46 +00:00
Umherirrender 9017ad5d76 Replace deprecated Linker::formatComment
Bug: T324906
Follow-Up: Ibe0092a96d96f6fa9d93991418b723f3e70e1b75
Change-Id: I375fe9114429057f7a0220fee50cb75d4e39864b
2023-08-03 23:37:32 +02:00
Daimona Eaytoy f305c2d778 Set a fixed default for echo-email-format
Always set the default value to HTML, and then potentially change it in
onUserGetDefaultOptions.

Bug: T341931
Change-Id: I19efaa2361cd936125b623f90d9a564caa51d4f1
2023-07-19 01:00:46 +02:00
Tim Starling bc7a6fc65b Use the new Wikimedia\Diff namespace
Bug: T339184
Change-Id: Ibe96f4301996f4c5e05a3de78d3e2787152393e4
2023-06-29 12:01:20 +10:00
Daimona Eaytoy baf711c3c5 Replace remaining usages of deprecated MWException
Bug: T328220
Change-Id: I97ea68525392e921b970d15b5d5ffd9c89bae452
2023-06-09 02:23:08 +02:00
Daimona Eaytoy 4cd98d3048 Replace some usages of deprecated MWException
Most notably, CatchableFatalErrorException and the code that throws it
are unused since Ic5712c4ce265b6faabce7a4028b4294fe3c73f18 (in 2016).

Bug: T328220
Change-Id: I5497347e41b21d2623b7e79bf7f977268a809c1d
2023-06-08 11:52:41 +00:00
jenkins-bot 7bfdebfa0b Merge "Add PLURAL support for "mark all as read" buttons" 2023-05-20 15:39:10 +00:00
jenkins-bot fbaa93f3bd Merge "Update moved class FauxRequest" 2023-05-19 14:38:13 +00:00
gerritbot 68b06cac10 Update moved class RawMessage
See T321882. Moved in I195cf4c67bd514

Bug: T321681
Change-Id: I6ca53fd2b8f3523ea5e29a9119d96da51e0a55a5
2023-05-19 10:30:54 +00:00
gerritbot f3da9368e8 Update moved class FauxRequest
See T321882. Moved in I832b133aaf61ee

Bug: T321681
Change-Id: Ie2e1ff04178e3f502f90336e68ab012636b46fb5
2023-05-19 10:24:07 +00:00
Kosta Harlan 61a656ac27
LinksUpdate: Don't send page-linked notifications for pages created by bot users
Follows-up: I704a2912e0a8b0e996d4e4e0a73f4ed3b9ccf6be
Bug: T318523
Change-Id: I32edf044b858956d030d318994d799071cde521b
2023-05-16 14:54:58 +02:00
Umherirrender ed5cabcb0e Replace deprecated Hooks::run
Bug: T335536
Change-Id: Ic7f758fc4f65e364aa23b218e5e62a47f1641d8e
2023-05-07 03:01:29 +02:00
Umherirrender 159863d15a Replace deprecated Hooks::run
Bug: T335536
Change-Id: I3f20828047a886e1140fa080e3f3f1945397424f
2023-05-06 19:59:22 +00:00
Jon Harald Søby 60748b0b25 Add PLURAL support for "mark all as read" buttons
Pass a relevant number of unread notifications to the messages
'echo-mark-all-as-read' and 'echo-mark-wiki-as-read' each time
they are used, in order to facilitate the use of PLURAL in
the messages. This allows translators to say e.g. "mark both as
read" when there are two unread notifications, for instance.

Bug: T321462
Change-Id: Ida65be2d7f2663d9802f71c7ea1eb588db8cd254
2023-04-29 01:31:14 +02:00
Kosta Harlan 53efddc825
Don't send page-linked notifications for pages created by bot users
Bug: T318523
Change-Id: I704a2912e0a8b0e996d4e4e0a73f4ed3b9ccf6be
2023-04-28 12:13:04 +02:00
gerritbot fd6bdf95af Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: Icf209fddd9367540352d935557881d7e6e5a1e4c
2023-04-25 09:53:21 +00:00
gerritbot 7ab2ea01a1 Update moved class TitleFactory
See T321882
Moved in Iac1688172ee457

Bug: T321681
Change-Id: I8c171d4cb1413d2acd20016f85220e9a33a006da
2023-04-19 16:55:32 +00:00
jenkins-bot 96f5ec469c Merge "Use foreach ( $array as $key => $value )" 2023-04-08 21:22:35 +00:00
Fomafix 2862711ad2 Use foreach ( $array as $key => $value )
Use

  foreach ( $array as $key => $value ) {

instead of

  foreach ( array_keys( $array ) as $key ) {
      $value = $array[$key];

Change-Id: I3a75d3c7a2b41888998af37701ed9075380d286a
2023-04-07 11:58:33 +00:00