Commit graph

1560 commits

Author SHA1 Message Date
gerritbot ac49cd6a9f Remove indirect calls to IDBAccessObject::READ_* constants
We are getting rid of the schema of implementing this interface and
calling self::READ_* constants, it's confusing, inconsistent, prone to
clashes and isn't really useful for non-ORM systems (which we are not)

Bug: T354194
Change-Id: Ic05e9fa663ddb97fcc8290f2629d3ad89b6791a5
2024-01-26 14:00:49 +00:00
thiemowmde 9bd80c6f46 Fix EchoRevertedPresentationModel using null as string
Bug: T355751
Change-Id: I69cf14c81502dc10e333ae2536437cde043ba92b
2024-01-24 12:14:33 +01:00
Func 00f464e0fe Revert "Set a fixed default for echo-email-format"
This reverts commit f305c2d778.

Reason for revert: This is not the way of setting the default user
option, the 'default' param for HTMLForm should be filled with the
user's current option.

Similar mistakes happened many times, maybe we should deprecate setting
this param for any field types other than the 'info' type at the
preferences form level.

Bug: T350530
Change-Id: I1d0fce3db4a4228a6adcd9fe12dbc3da7ac0f710
2024-01-10 02:56:54 +08:00
Reedy 0bc5808783 Drop schema updates from MW 1.33 and 1.34
Change-Id: I9515984e294cd3910a841a07eb3239fa20040a3e
2023-12-22 01:56:23 +00:00
Martin Urbanec 1e7c1ae8e4 Hooks: Remove override for email reverted
This override is not actually overriding anything,
as we default to false for most email notifications,
including reverted. This just confused me for some time,
so removing the line to avoid that re-happening.

Bug: T353225
Change-Id: Iccd28d61c6fec860ceeb3527827089a65bf17ff8
2023-12-13 11:47:51 +01:00
Umherirrender a0ca1d89c6 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements done manually

Change-Id: Iad87245bf8082193be72f7e482f29e9f1bad11fc
2023-12-11 16:39:00 +01:00
gerritbot 2560aa4b7f Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Ic3e56c6e2ec606bbecbd630d8ad96d111cab24d3
2023-11-29 15:34:02 +00:00
gerritbot 51760eefcc Update UserOptionsManager's FQN
User-options related classes are being moved to
the MediaWiki\User\Options namespace in MediaWiki Core;
reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Iddefd90b03a4751fce3f44e9fa0086082b21ae93
2023-11-29 12:55:39 +00:00
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