Commit graph

17601 commits

Author SHA1 Message Date
jenkins-bot
23686f4a37 Merge "Allow extensions to send password resets without a local user/email" 2024-09-19 10:58:00 +00:00
jenkins-bot
0e5d1eab32 Merge "auth: Add base class for TemporaryPasswordPrimaryAuthenticationProvider" 2024-09-19 10:33:44 +00:00
jenkins-bot
9ad13c2812 Merge "Update user widgets to support named and temp account exclusion" 2024-09-19 10:07:25 +00:00
jenkins-bot
a335696207 Merge "build: Remove exclude of MediaWiki.Commenting.PropertyDocumentation" 2024-09-19 05:34:38 +00:00
jenkins-bot
f506d24398 Merge "tests: Add missing documentation to class properties" 2024-09-19 05:31:30 +00:00
MusikAnimal
de2b3f7a59 mediawiki.special.block: make submit destructive and use old messages
SpecialBlock calls HTMLForm::setSubmitDestructive(). This patch applies
that to the new Vue version of Special:Block.

Additionally, since we're not going to enable multiblocks in the initial
launch, the submit button message is changed to as it was before. "Save
block" is questionable even for multiblocks. It will likely be a while
before we iron out the UI for multiblocks, so we might as well remove
now-unused 'block-save' message.

The "[username] is already blocked" message is now also surfaced, i.e.
browsing to [[Special:Block/someblockuser]]. Like the old Special:Block,
changes to the block target field won't re-query to see if the user is
already blocked (though that would be a fine improvement). However
*unlike* the old Special:Block, such changes do make the message
disappear.

Bug: T373572
Change-Id: Iceaedbb1e3496c52b49a2b96d65445da45261b9f
2024-09-18 20:43:22 -04:00
Arlo Breault
a54f6d851c Re-order arguments to DataAccess::addTrackingCategory
Match the order of other methods of that class.

Follows-Up: Id4b29c6d09c79649c94d2da2e678af52a967bbe5
Change-Id: Ic8f70ba2b6466bb91f467d4e87e9de9e09c0245a
2024-09-18 14:59:00 -04:00
Umherirrender
f09beca7ca build: Remove exclude of MediaWiki.Commenting.PropertyDocumentation
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Enable the sniff to avoids that new code is missing type declarations.

Depends-On: I4b182fda29e9cb9719c26fd01a609de2453be56d
Depends-On: I1106dd167dc2188ed91d1884e979b5cea303f722
Depends-On: I2606072015d71b4bdda70a7c149d9f55ac205a3c
Depends-On: I90ecf85cb6f639af4be1947ccfbfb16d5b84cab3
Depends-On: Ib0402017e602ad3e79b7ffbb5b02bcedae1fab6b
Depends-On: I29bc609c5148668e533a9ed9f72b29f780f00dba
Depends-On: Ib6081f5519d2294bb14f81bf399f9c45315f2b69
Depends-On: Ifbc2ce0c68865c5d32689e56c6215a5099f7478b
Depends-On: I72c7dab67ef12d229fb232311e404467260d742d
Depends-On: Id994553eaeac181775ac782423ff53928ad45466
Depends-On: Id08ee260e320d8c97c2c3576d998af1b70952f27
Depends-On: I65636f2b97b44387c4320ebfb4be6c81d6f771b9
Depends-On: I897106d15c9e43f75eb006c35a14ac49edeb3ecd
Depends-On: I39ce744ee4f4a9356b0788b6e38ece9635a5ca49
Depends-On: I8a45487483c54b50576c8cbef3f8ea7b3b19969a
Depends-On: Id7ccd48e3bf626095e2d3929831b5d87ed0be948
Depends-On: I07ce1f37d1bfb18d6e73dd008a712b3ca60a80e9
Depends-On: Id75cb2e5fbee0fe7600f92473d876f23730d46b7
Depends-On: I217b9c906972c1f335e8e7d2b340e86a4d92c5a1
Depends-On: Ia1302c9c0528691436a0411ca62b651471811c98
Depends-On: I45c62ed8b6c2893b66f12dc60580c0267b475945
Depends-On: Ia8bbdc4dee59dfb487582dd514486ec8542951be
Depends-On: I9e5330601ded043ad24a99932fe3fa0ea6c427aa
Depends-On: I67bb532efff05b7fb01abec540620239cb4031b2
Depends-On: Ia205d578b9620960d967e2cbeb418e7e5af94dd4
Depends-On: Idf17719c875466810313f0fbbf16bc67f3e40059
Depends-On: I8b33b5f4d91c1935228e7010327dbc6ce138fc00
Depends-On: I3afaba387663320187c49ff1cdb2ff3ae01681ad
Depends-On: I48014b6464f3e7e2b7f083e67f517af0b1a9367e
Depends-On: I6ff2b1e91f28340f8f467a1d5e50cc132e142b95
Depends-On: I113b040321d27c84fe9b807c162736909e96fb20
Depends-On: I7dec01892a987a87b1b79374a1c28f97d055e8fa
Depends-On: I921c5cbe5b811c5ade9d9fad56ad3499ef8373e0
Depends-On: I46f46f1855ca32c89a276b06f4e2051ff541886e
Depends-On: I41ad89cc3112a2911ad40c55583bff2d7787da68
Depends-On: I1f306a3925d6768209a06e70082598b2f70cd319
Depends-On: Ifc27750207edc09e94af030d882b6f1a5369cf98
Depends-On: I81544e367543846654b4d03fcad5adad71e23751
Depends-On: I56a1d27ba2dfbcdd929a0e0c96664bc2a31e38f2
Depends-On: I6dd402a5bca0c2136595faedae315959bbcf17d9
Depends-On: I82b4f543ed004fc960b6b1f8ac718db2a63a40fe
Depends-On: I1da4b272a6b28c419cc8e860d142dae19ca0bbcf
Depends-On: I6087dcdac761916359009548beb5210671a32ee5
Depends-On: I73c413727a63d14efb5028b27128784c98724110
Depends-On: Ifddb6a95d0d81fef4c480ef96dbc1fc9cbb93401
Change-Id: I97a8b6fbe17a24ddffcc6a3fd4ea4451b59ba790
2024-09-18 17:27:01 +00:00
Umherirrender
41f6d9eee4 tests: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Ifc27750207edc09e94af030d882b6f1a5369cf98
2024-09-18 17:25:42 +00:00
jenkins-bot
258e2f08dd Merge "Add plural rules for Interslavic" 2024-09-18 09:13:01 +00:00
jenkins-bot
82b7b8469f Merge "language: Add missing documentation to class properties" 2024-09-17 22:58:47 +00:00
jenkins-bot
caee320467 Merge "Remove unchecked exception annotations" 2024-09-17 22:19:55 +00:00
jenkins-bot
110def6108 Merge "ResourceLoader: Fix SkinModule aliases to not override existing keys" 2024-09-17 20:40:30 +00:00
Adam Wight
188d2cbbb0 Remove unchecked exception annotations
Callers should not catch an unchecked exception, so it doesn't belong
in a function signature.  Unchecked exceptions indicate a coding error,
which by definition the code will not be able to handle correctly.

If any of these exceptions were supposed to be in response to an edge
case, user input, or initial conditions, then they should be changed
to a runtime error.  If the exception class cannot be changed, then
the annotation should include a comment explaining its purpose and
prognosis.

Bug: T240672
Change-Id: I2e640b9737cb68090a8e1cb70067d1b74037d647
2024-09-17 22:20:58 +02:00
jenkins-bot
8c803338a5 Merge "ResourceLoader: Minor doc blocks and coding style cleanup" 2024-09-17 19:33:12 +00:00
jenkins-bot
1478af45dc Merge "ResourceLoader: Reduce deprecation clutter in SkinModule" 2024-09-17 19:33:04 +00:00
Umherirrender
eb28edd84e language: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I73c413727a63d14efb5028b27128784c98724110
2024-09-17 18:25:25 +00:00
jenkins-bot
65b9d6bb39 Merge "REST: add restbase compat error handling mode" 2024-09-17 12:21:35 +00:00
jenkins-bot
78a48b9a45 Merge "ApiParse: don't reparse language link titles" 2024-09-17 03:31:40 +00:00
Timo Tijhof
e03380c714 ResourceLoader: Fix content-links compat
This never worked because it looked for `element` instead of `elements`.
The test repeated the same mistake.

Bug: T278576
Bug: T255717
Change-Id: I9bfceb6b8bd761244af6eda0e2ae08e98238aa76
2024-09-17 03:22:14 +00:00
Timo Tijhof
123da635a1 ResourceLoader: Fix SkinModule aliases to not override existing keys
While not documented or tested, aliases previously not only adding
but also replaced values.

Instead, emit a warning to inform skin developers of this conflict.

Note that the `content-links => elements` alias already behaves
this way (only if not already set), which the other aliases would
now be consistent with.

Change-Id: I66ae66b37bba14b2f65710f3d32f17d4e9a5a7a3
2024-09-17 03:22:04 +00:00
Timo Tijhof
3d924e4ed1 ResourceLoader: Minor doc blocks and coding style cleanup
* Function alls are either complete on one line or one arg
  per line. Avoid confusing calls where the args are on their
  own line as this creates visual ambiguity over how many args
  are passed, and what each piece belongs to. For example, is
  `true` or `false` passed as 2nd arg to applyFeaturesCompatibility?

* Replace comment about list-form behaviour with something that
  provides intention and insight instead of merely repeating what
  can already be seen from the code.

* Fix malformed `@param` docs that used variable as part of sentence.

* Use named data providers to ease PHPUnit debugging,
  and to make code coverage reports on doc.wikimedia.org more useful.

Change-Id: I2efd6cc7ac59c80684c9411025c4226473a36d43
2024-09-17 03:20:15 +00:00
Timo Tijhof
3ee96d47b6 ResourceLoader: Reduce deprecation clutter in SkinModule
* Move docs for deprecated aliases from top-level mentions into
  footnotes under primary docs. Still easy to search for, but no
  longer advertised as important for skin devs to know about
  or scan past when reading.

* Fix bug in 'legacy' logic where the key was not unset, thus
  mandating a needless entry in FEATURES constant. With the bug
  fixed, this internal entry is no longer needed.

* Fix bug in 'interface' logic where the key was not unset
  when the value is false. This would break the "skins.vector.styles"
  module otherwise, and had a similar workaround in place that
  is now no longer needed.

* Remove other unneeded entries in FEATURES for keys that were
  already being unset by applyFeaturesCompatibility().

* Remove deprecation warnings in favour of letting ResourceModules
  give a stable interface from ResourceLoader to skin.json.

* Add missing test to confirm no-op behaviour.

Bug: T374262
Change-Id: I9f4b1d48127d0afe67bada44d8dc4472507f9506
2024-09-16 20:17:34 -07:00
jenkins-bot
3eed76687b Merge "mocks: Add missing documentation to class properties" 2024-09-17 02:19:30 +00:00
jenkins-bot
7a07c29408 Merge "tests: Remove unused PreprocessorTest::$mTitle/$mPPNodeCount" 2024-09-17 02:19:24 +00:00
jenkins-bot
621614fab2 Merge "mediawiki.special.block: add reason field" 2024-09-17 01:18:28 +00:00
jenkins-bot
a5827e36d7 Merge "Skin: don't reparse language link titles" 2024-09-17 00:30:03 +00:00
C. Scott Ananian
01876b0121 ApiParse: don't reparse language link titles
When there are conflicts between namespace prefixes and interwiki prefixes,
ApiParse was inadvertently converting from an interwiki link to a local link
by reparsing the title.  Use a TitleValue as an intermediary to ensure
the interwiki link stays an interwiki link.

Bug: T204792
Bug: T363538
Change-Id: I6a94350b781539de2390070e4bcbad4b19eba78f
2024-09-16 19:34:02 -04:00
C. Scott Ananian
e56db8f32e Skin: don't reparse language link titles
When there are conflicts between namespace prefixes and interwiki prefixes,
the Skin was inadvertently converting from an interwiki link to a local
link by reparsing the title.  Use a TitleValue as an intermediary to
ensure the interwiki link stays an interwiki link.

Bug: T204792
Bug: T363538
Change-Id: I351dfcff7cd6b32f4fa67507e5c5a432dce61a01
2024-09-16 19:23:50 -04:00
bpirkle
90494183bb REST: add restbase compat error handling mode
In order to replace certain /api/rest_v1 endpoints, we
need to have something in MediaWiki that generates a compatible
responser. The MediaWiki REST API error format does not match
RESTbase. So the easiest approach seemed to be to
add a compatibility mode, triggered using the x-restbase-compat
header. This can be set via the gateway when rerouting the request.

Bug: T374136
Change-Id: I73934940d367be52941bd27861c248ab5bcfb5d2
2024-09-16 18:09:12 -05:00
jenkins-bot
5253dd5bf3 Merge "Test exportSites.php and importSites.php" 2024-09-16 22:56:25 +00:00
jenkins-bot
53cf25d935 Merge "Partly test deleteTag.php" 2024-09-16 22:46:27 +00:00
jenkins-bot
20514decd8 Merge "ParserOutput::collectMetadata(): fix handling of links" 2024-09-16 21:45:58 +00:00
Bartosz Dziewoński
2fcf05c208 Allow extensions to send password resets without a local user/email
Move the checks for the existence of the user and the presence of
their email address before the 'SpecialPasswordResetOnSubmit' hook,
instead of after. This allows extensions to make their own decisions
about whether a user exists or has email.

This also means that extensions must now check the 'requireemail'
preference when only the username is provided. They already had to
check it when only the email was provided, so this seems more like a
bug fix. To allow them to check this logic, if both the username and
email were provided by the user, provide both of them to the hook.

Bug: T151012
Change-Id: I6baf2c5194f981803198729f59e1e83d5644383a
2024-09-16 23:09:04 +02:00
Bartosz Dziewoński
7772b58bb9 auth: Add base class for TemporaryPasswordPrimaryAuthenticationProvider
Bug: T149003
Change-Id: I38c0de0ed52f4e35db443bc22d4ed110eafac97b
2024-09-16 23:09:01 +02:00
jenkins-bot
634373a3cf Merge "REST: add restbase compat mode for some endpoints" 2024-09-16 19:21:57 +00:00
Jamie Kuppens
2537859104 Update user widgets to support named and temp account exclusion
* This change introduces two new optional parameters to the 'allusers'
  API call named 'excludenamed' and 'excludetemp' that allows filtering
  accounts based on whether they're named accounts or temporary
  accounts. This is tested by using the temporary matchPattern
  configured with $wgAutoCreateTempUser.

* User widgets that call 'allusers' have been updated so that
  'excludenamed' and 'excludetemp' can be optionally set so that named
  or temporary accounts may not returned with user suggestions.

Bug: T332030
Change-Id: I6563ae610017fd1cd35c36ba65906041f7f68c4b
2024-09-16 08:45:58 -07:00
jenkins-bot
102ab8b972 Merge "htmlform: Add missing documentation to class properties" 2024-09-16 13:35:00 +00:00
Dreamy Jazz
d814e25a81 Test exportSites.php and importSites.php
Why:
* Maintenance scripts in core have low test coverage.
* Testing scripts which are not overly complex should create
  less complex tests that easily raise test coverage.

What:
* Create a test for both exportSites.php and importSites.php which
  checks that the XML file produced by exportSites.php can be
  parsed and produces the same sites table config as was exported.

Bug: T371167
Change-Id: I3eb1b86803ee2413e624f9ffe699a60161103758
2024-09-16 11:51:34 +00:00
daniel
602f0ab595 REST: add restbase compat mode for some endpoints
In order to replace the /api/rest_v1/page/title/{title} endpoints, we
need to have something in MediaWiki that generates a compatible
responser. The v1/page/{title}/bare and v1/revision/{id}/bare endpoints
are functionally equivalent, so the easiest approach seemed to be to
add a compatibility mode to them. The compatibility mode is triggered
using the x-restbase-compat header, which can be set via the gateway
when routing the request from /api/rest_v1/page/title/.

Bug: T374136
Change-Id: I4af7ff5325660ae30faebb24753b9dc1c3acb2b3
2024-09-15 16:41:21 -05:00
Umherirrender
aed646001c htmlform: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I1f306a3925d6768209a06e70082598b2f70cd319
2024-09-14 11:49:05 +00:00
Umherirrender
bb1d0aca81 recentchanges: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I82b4f543ed004fc960b6b1f8ac718db2a63a40fe
2024-09-14 10:09:46 +02:00
Umherirrender
352a61e518 mocks: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I56a1d27ba2dfbcdd929a0e0c96664bc2a31e38f2
2024-09-14 09:55:06 +02:00
Umherirrender
eeaa2a1932 tests: Remove unused PreprocessorTest::$mTitle/$mPPNodeCount
Unused since addition in 0127c7c446 (r80375)

Change-Id: I81544e367543846654b4d03fcad5adad71e23751
2024-09-14 09:46:49 +02:00
jenkins-bot
bcd8cd29f6 Merge "specials: Add missing documentation to class properties" 2024-09-14 02:51:02 +00:00
jenkins-bot
df07b07b4a Merge "libs: Add missing documentation to class properties" 2024-09-14 02:38:58 +00:00
jenkins-bot
aaf5dc65f5 Merge "lockmanager: fix MemcLockManager::__destruct()" 2024-09-13 22:20:15 +00:00
Dreamy Jazz
1eb3016d1b Partly test deleteTag.php
Why:
* Maintenance scripts in core have low test coverage
* Testing less complex parts of the scripts will help quickly
  improve test coverage.

What:
* Create DeleteTagTest which partly tests the script.

Bug: T371167
Change-Id: I55370a855a7f88f94aa2e2037edb478ea86f266a
2024-09-13 21:06:34 +00:00
jenkins-bot
2853c03c2d Merge "phpunit: RandomImageGenerator::getImageWriteMethod returns callable" 2024-09-13 21:01:57 +00:00
Umherirrender
6635b31599 specials: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I41ad89cc3112a2911ad40c55583bff2d7787da68
2024-09-13 19:10:50 +00:00
C. Scott Ananian
9b60718f92 ParserOutput::collectMetadata(): fix handling of links
For language links, when there are conflicts between namespaces and
interwiki prefixes, it is important to use TitleValue for language links
rather than to try to reparse the Title.  Language links also preserve
fragments, unlike other link types in ParserOutput; added tests to
document this.

Added handling for interwiki links and template links.

Bug: T363538
Change-Id: I6e8ff8ed7f8819000cc3f80e49c0739b568217a4
2024-09-13 14:42:27 -04:00
jenkins-bot
dbb28b2699 Merge "Fix old autoblock unblock log entries with namespace in log_title" 2024-09-13 18:38:31 +00:00
jenkins-bot
ced29cfbe0 Merge "maintenance: Add missing documentation to class properties" 2024-09-13 18:15:35 +00:00
jenkins-bot
a27ade70ee Merge "Use const keyword for constant list of strings or ints" 2024-09-13 18:08:57 +00:00
Umherirrender
c8ec25a961 maintenance: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I7dec01892a987a87b1b79374a1c28f97d055e8fa
2024-09-13 19:29:24 +02:00
Umherirrender
da63db52af libs: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I46f46f1855ca32c89a276b06f4e2051ff541886e
2024-09-13 17:24:12 +00:00
Dreamy Jazz
44cad41d03 Fix old autoblock unblock log entries with namespace in log_title
Why:
* The logging table on en.wikipedia.org contains an entry from
  2005 which is an unblock of an autoblock. However, the log_title
  contains the namespace, which makes the code that looks for
  logs which target an autoblock fail (because it checks for the
  first character being '#').
* Fixing the log_title to remove the 'User:' prefix from rows which
  are autoblocks (i.e. searching for log_titles which start with
  'User:#') should address the exceptions seen on Special:Log for
  these rows.
** The search can be limited to rows which have the 'unblock'
   log_action, as this has only been seen for this type of log.

What:
* Create fixAutoblockLogTitles.php which searches for the entries
  and then updates the log_title value to no longer include the
  'User:' prefix
** The queries to search are split, such that the expensive LIKE
   query is performed on batches of row IDs. If the LIKE query is
   applied directly to all rows in the table, the query takes 30s
   to run on WMF production.
* Add this maintenance script to update.php. It will be run once
  as the class extends LoggedUpdateMaintenance.
* Test the newly added maintenance script to ensure it works.

Bug: T373929
Change-Id: Ia62db56eda456bb764303b5f4b5a29be8f2d8fff
2024-09-13 12:18:32 +00:00
jenkins-bot
7e00281a46 Merge "lockmanager: cleanup RedisLockManager::__destruct() and add tests" 2024-09-13 00:58:00 +00:00
Aaron Schulz
8e875faf08 lockmanager: fix MemcLockManager::__destruct()
Previously, if any locks where left, the destructor would call
the doUnlock() method, which would always throw an exception.

Add some basic tests for MemcLockManager.

Change-Id: Ie0f398a14f154e5cede210cca633c7e7e90a7f57
2024-09-13 00:36:17 +00:00
Aaron Schulz
b6a79ae45b lockmanager: cleanup RedisLockManager::__destruct() and add tests
Remove pointless and risky-looking while loop.

Change-Id: I02ff99a5896a9adcfe48480e8bfec63e0f65fc36
2024-09-13 00:30:00 +00:00
jenkins-bot
ab14c236cd Merge "rdbms: Add missing documentation to class properties" 2024-09-12 23:25:03 +00:00
jenkins-bot
88f217a052 Merge "tests/api: Add missing documentation to class properties" 2024-09-12 23:24:46 +00:00
jenkins-bot
7419cb93b3 Merge "Rest: Add missing documentation to class properties" 2024-09-12 23:17:43 +00:00
Umherirrender
9087fff735 tests: Remove unused TagsDefTest::$testClass
Added unused in c2b1525908

Change-Id: I921c5cbe5b811c5ade9d9fad56ad3499ef8373e0
2024-09-12 22:24:02 +02:00
jenkins-bot
bc055b6ca4 Merge "Customise Special:UserLogout success message for temporary account" 2024-09-12 11:18:07 +00:00
Dreamy Jazz
ab89fff633 Customise Special:UserLogout success message for temporary account
Why:
* When a temporary account exits their session, the
  Special:UserLogout page is loaded to indicate the success.
* However, the success page talks about the temporary account
  logging out which may cause confusion.
* Per design mocks shared on T374519, this should be modified
  to indicate that the user logged out of a temporary account.

What:
* Set 'templogout' as the page title when the user is logging out
  of a temporary account.
* Set 'logouttext-for-temporary-account' as the message shown
  for a logout success when the user is logging out from a
  temporary account
* Update mediawiki.page.ready/ready.js to add a flag to the
  URL Special:UserLogout URL that is redirected to once the
  logout API call has occured.
* Update tests for SpecialUserLogoutTest

Bug: T374519
Change-Id: Ib62cdb5ba716976321cd556aa9defe97b3446b33
2024-09-12 11:06:46 +01:00
hmonroy
2d1a3660e3 mediawiki.special.block: add reason field
Add Html::listDropdownOptionsCodex() that takes a bulleted list like
[[MediaWiki:Ipbreason-dropdown]] and adapts the data struture for use
with a Codex Select component.

Currently optgroups are not supported (T367241) so we show the optgroup
labels as disabled options instead.

URL query string parameters do not yet prefill any fields. This will be
tackled as part of T368583.

Bug: T362912
Change-Id: Ib89dcf35ca2a1cd74404c42f5411d7c095b98952
2024-09-11 21:14:25 -04:00
Umherirrender
465777f188 Use const keyword for constant list of strings or ints
Also changed visiblity of some to private

Change-Id: I113b040321d27c84fe9b807c162736909e96fb20
2024-09-11 23:16:24 +02:00
Umherirrender
e38e3d1c49 rdbms: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I9e5330601ded043ad24a99932fe3fa0ea6c427aa
2024-09-11 21:24:59 +02:00
jenkins-bot
41e428a0a5 Merge "Fix broken deleteSelfExternals.php and test it" 2024-09-11 18:57:37 +00:00
jenkins-bot
2f38506886 Merge "Test grep.php" 2024-09-11 18:36:23 +00:00
jenkins-bot
3c9691ea24 Merge "Start on tests for userOptions.php" 2024-09-11 18:30:43 +00:00
jenkins-bot
076470f703 Merge "Expand ResetUserEmailTest" 2024-09-11 18:30:33 +00:00
jenkins-bot
30f43bb368 Merge "Expand MigrateUserGroupTest" 2024-09-11 18:29:11 +00:00
jenkins-bot
8ef0f2e7b7 Merge "Move BenchmarkerTest and MaintenanceTest into includes folder" 2024-09-11 18:28:04 +00:00
jenkins-bot
d4f5d4169e Merge "Start on tests for updateExtensionJsonSchema.php" 2024-09-11 18:27:55 +00:00
jenkins-bot
4cab46afac Merge "Test alltrans.php and dumpMessages.php" 2024-09-11 18:27:46 +00:00
jenkins-bot
558c97832b Merge "Expand RollbackEditsTest" 2024-09-11 18:27:38 +00:00
Dreamy Jazz
4a6de09299 Fix broken deleteSelfExternals.php and test it
Why:
* The deleteSelfExternals.php maintenance script is broken on
  my local wiki as the SQL generated by the script errors out
  when run on MariaDB.
* This script should be fixed, updated to use the query builders,
  and tested to ensure that any future breakages do not go
  unnoticed.

What:
* Fix the deleteSelfExternals.php script to use a DELETE query
  that works, by generating it using the query builder.
* Create DeleteSelfExternalsTest to test that the script now
  works.

Bug: T371167
Change-Id: Id423fa5c1bfe666f57a38e733334342ac1ad2cea
2024-09-11 18:23:40 +00:00
jenkins-bot
01a6b2f8fe Merge "Expand GetTextMaintTest" 2024-09-11 18:17:00 +00:00
jenkins-bot
0375988caa Merge "Expand CleanupWatchlistTest" 2024-09-11 18:16:52 +00:00
thiemowmde
9d354eeccc phpunit: RandomImageGenerator::getImageWriteMethod returns callable
This makes the code discoverable by IDEs and such. The methods are
not flagged as unused any more.

Also add a bunch of type declarations to closely related code, and
remove more unused code and obsolete and redundant comments.

Change-Id: Ibbb3b5a8f3d84a6635ae794a5179931e0ae6e7a9
2024-09-11 07:53:30 +02:00
jenkins-bot
09121089f4 Merge "auth: Disable irrelevant account creation fields for temp users" 2024-09-10 20:05:43 +00:00
Umherirrender
6323406dd5 tests/api: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I48014b6464f3e7e2b7f083e67f517af0b1a9367e
2024-09-10 18:52:41 +00:00
jenkins-bot
4a611caaa7 Merge "UserOptionsManager: Allow global prefs for users without local accounts" 2024-09-10 18:22:53 +00:00
Máté Szabó
d150c66840 auth: Disable irrelevant account creation fields for temp users
Why:

- When signing up for an account, temporary users are currently forced
  to provide a reason for creating an account, and also have the option
  to send a temporary password to an email address.
- Neither of these options are useful for temporary users wanting to
  create a full user account.

What:

- Don't show these two form fields on Special:CreateAccount for temporary users.
- Add a functional test for the temporary user account creation flow.

Bug: T328718
Change-Id: Ie545857f7647be89d9462ec2b0def48690f0a2bf
2024-09-10 16:45:56 +02:00
thiemowmde
18ee885652 phpunit: Drop unused complexity from RandomImageGenerator
I believe we don't need this any more. A test should never leave an
uploaded image behind, but delete it. It should be totally fine when
the same trivial test uploads the same image over and over again. All
the extra complexity to trick MediaWiki's duplicate detection shouldn't
be necessary (any more).

Also change the default to svg instead of jpg. Again, this creates much
smaller files with much less effort.

Note this code was already mostly unused because of the previous patch
I7f3d586.

Change-Id: I5c16ba7bed0fffa43549b786e50d6d1dd5592ad0
2024-09-10 11:05:22 +02:00
Bartosz Dziewoński
949c34b205 UserOptionsManager: Allow global prefs for users without local accounts
Bug: T371340
Change-Id: I5eba0fa558ad7f111988c17cfcee260c5a272baf
2024-09-10 00:01:58 +02:00
jenkins-bot
2d0ee0b35a Merge "Avoid use of deprecated wfExpandUrl in ExtractBody" 2024-09-09 19:51:56 +00:00
jenkins-bot
766c824327 Merge "Make MultiHttpClient free from MediaWiki URL global functions" 2024-09-09 19:42:08 +00:00
jenkins-bot
29b407432c Merge "ResourceLoader: Test DependencyStore with indirect styles dependencies" 2024-09-09 18:36:11 +00:00
Ebrahim Byagowi
fb05f32141 Make MultiHttpClient free from MediaWiki URL global functions
It removes use of already deprecated global functions,
wfParseUrl and wfAssembleUrl by use of PHP's parse_url
and use of UrlUtils::assemble copy.

Change-Id: I07a5b351973228ea2e4545d042bb53ddf2c5730a
2024-09-09 22:02:58 +03:30
Hannah Okwelum
9fffe0a559 ResourceLoader: Test DependencyStore with indirect styles dependencies
Bug: T343492
Change-Id: Ic6f34fbedd47962e2df9cb00c32df6fc93912c02
2024-09-09 18:07:35 +00:00
jenkins-bot
e6d0f05427 Merge "Return early in ApiLogout if user not logged in" 2024-09-09 17:34:51 +00:00
Ebrahim Byagowi
825f7b5e13 Avoid use of deprecated wfExpandUrl in ExtractBody
Change-Id: Ic68ecf6654c8e73a643adce2ef5dccb53b7a632a
2024-09-09 19:38:04 +03:30
jenkins-bot
1397b8db2c Merge "search: Add missing documentation to class properties" 2024-09-09 13:29:43 +00:00
Dreamy Jazz
24d8b04558 Return early in ApiLogout if user not logged in
Why:
* The 'logout' API allows users to logout of their account
* This calls the "UserLogoutComplete" hook which users assume
  is only called when a logout is successful.
* However, the hook is called by the API even if the user making
  the request was not logged in
* The Special:UserLogout page does not call the hook if the user
  performing the request is already logged out.

What:
* Return early in ApiLogout::execute if the user is not logged
  in, and also add a warning to the response to indicate this.

Bug: T374353
Change-Id: I72e73c2391a475cec2e5cb24250f9aa2b792e5de
2024-09-09 13:47:50 +01:00
jenkins-bot
4d58855717 Merge "Avoid use of deprecated wfExpandUrl in IntroMessageBuilder" 2024-09-08 20:56:45 +00:00
jenkins-bot
28c0173022 Merge "ResourceLoader: Add missing documentation to class properties" 2024-09-08 20:11:55 +00:00
Ebrahim Byagowi
7db85051f8 Avoid use of deprecated wfParseUrl in MediaWiki\Api
Change-Id: Idd0f98ccb449735b5244bb7531327be763daceb8
2024-09-08 21:15:44 +03:30
Ebrahim Byagowi
6f1acdda65 Avoid use of deprecated wfExpandUrl in IntroMessageBuilder
Bug: T319340
Change-Id: I77542ef7cbe38fcc4eee42873610c50236e41661
2024-09-08 06:46:37 +03:30
Umherirrender
6c81485143 search: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I2606072015d71b4bdda70a7c149d9f55ac205a3c
2024-09-07 21:56:00 +02:00
Umherirrender
503bff0b04 Rest: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Idf17719c875466810313f0fbbf16bc67f3e40059
2024-09-07 21:49:56 +02:00
Umherirrender
441017cb54 ResourceLoader: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I90ecf85cb6f639af4be1947ccfbfb16d5b84cab3
2024-09-07 21:25:51 +02:00
Amir E. Aharoni
d7b68f9e74 Add plural rules for Interslavic
Bug: T369453
Change-Id: I824105682a49a23cfc7260d10467604b27a85e9b
2024-09-07 15:08:41 -04:00
jenkins-bot
286925fcef Merge "Hard deprecation of wfExpandIRI" 2024-09-07 13:07:24 +00:00
Ebrahim Byagowi
ba2190a467 Hard deprecation of wfExpandIRI
Deprecated since 1.39, now let's emit warning.

Depends-On: Ib08a0cc47a7b0d8ec7375d4505b447c4b770d4ef
Change-Id: I6bd166b998b2283ef0fb2de56a517b74d004f991
2024-09-07 08:03:40 +03:30
Ebrahim Byagowi
136a799336 Remove wfUnpack, deprecated since 1.42
Change-Id: I7e5df58fe809d3adb61bdb64444c4ca98641c6c6
2024-09-07 06:48:35 +03:30
jenkins-bot
15bfd2e9f8 Merge "Remove ParserOutput::getText() calls from core (runOutputPipeline)" 2024-09-06 19:39:11 +00:00
Isabelle Hurbain-Palatin
ce2bccc0a8 Remove ParserOutput::getText() calls from core (runOutputPipeline)
This is the fourth patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.

Here we replace calls to getText where a ContentRenderer is available
close by by temporary ParserOutput::runOutputPipeline that will
eventually be replaced by a call to (probably) ContentRenderer
 (T371004). Doing this work in stages allows us to separate the work of
"bring ParserOptions to the call site" from the work of "bringing
ContentRenderer(ish) to the call site", since both need to be done for
to make ParserOutput a value object (T293512).

Change-Id: Ib4f9357293dc230df6e0ca2379a1e2a4cc1b91b7
Bug: T293512
2024-09-06 19:07:49 +00:00
Ebrahim Byagowi
ea43a44a2e Remove wfRemoveDotSegments, deprecated since 1.39
It didn't have any use outside the core so went for the removal
instead of raising warning and hard deprecation.

Change-Id: I08dab348a89f1fe1adccfad4f003d9fb8b233f0d
2024-09-06 22:00:09 +03:30
jenkins-bot
1d82c79b79 Merge "Use stashed temp name in ParserOptions::newFromContext over anon" 2024-09-06 16:53:23 +00:00
jenkins-bot
3909efa52e Merge "Fix typo in browser vendor prefix" 2024-09-06 12:45:58 +00:00
Dreamy Jazz
ea295a2b5f Use stashed temp name in ParserOptions::newFromContext over anon
Why:
* The REVISIONUSER magic word displays the username of the user
  making the edit when the user is previewing an edit
* When temporary accounts are enabled, the user performing the
  edit should see a temporary account name and not an IP address
  to avoid confusion.
* This currently works as intended for all but the user's first
  edit because, until they have submitted their first edit, they
  have no temporary account. However, they should have a stashed
  name for a non-existing account.
* Setting the ParserOptions user as the stashed name in this
  edge case fixes the issue and should not cause unintended side
  effects.

What:
* Update ParserOptions::newFromContext to use the stashed temporary
  account name if all of the below are true:
** The current context user is an IP address
** Temporary account autocreation is enabled
** The user has a stashed name defined in their session
* In all other cases the user used in ParserOptions::newFromContext
  is unchanged.
* Add tests for ParserOptions::newFromContext to verify these
  changes and to avoid regressions.

Bug: T372723
Change-Id: Ie532aa997a59cbf5204a554bd087ba7451f7d47a
2024-09-06 13:44:33 +01:00
jenkins-bot
07437e797b Merge "Add missing documentation to class properties (frontend-related)" 2024-09-06 08:07:40 +00:00
jenkins-bot
043156a21f Merge "tests: Remove unused JobQueueTest::$key" 2024-09-06 07:59:23 +00:00
jenkins-bot
838f8962b6 Merge "tests: Remove reset of services in tests" 2024-09-06 07:57:58 +00:00
Jon Robson
6bd260d7b2 Fix typo in browser vendor prefix
This is preventing icons from displaying in older Chrome browsers

Change-Id: I017da77ccda5763dc0312859127c453ba69e4029
2024-09-05 22:19:48 -07:00
jenkins-bot
dbb984360a Merge "objectcache: Remove WinCache support" 2024-09-06 01:19:59 +00:00
Umherirrender
5d5a976455 tests: Remove reset of services in tests
Before a test is started there are no services, there is no need to
reset services in setUp().
After a test finished all created services are destroyed by
MediaWikiIntegrationTestCase and does not need own teardown.
overrideConfigValue() also resets services

Change-Id: I41c71866ec6d93cd2b7e3dd45269e0972ed6a273
2024-09-05 23:47:16 +02:00
jenkins-bot
8c12d1ec9b Merge "Add new hook OutputPageRenderCategoryLink" 2024-09-05 20:51:03 +00:00
Umherirrender
99427a6f03 tests: Remove unused JobQueueTest::$key
Added unused in 9cc7e6a39a

Change-Id: I217b9c906972c1f335e8e7d2b340e86a4d92c5a1
2024-09-05 22:34:51 +02:00
jenkins-bot
75571982bf Merge "phpunit: Set much smaller defaults for RandomImageGenerator" 2024-09-05 20:14:13 +00:00
jenkins-bot
570dff2990 Merge "Add tracking category resolution to Parsoid DataAccess" 2024-09-05 20:08:10 +00:00
thiemowmde
ca453df37e phpunit: Set much smaller defaults for RandomImageGenerator
This class is not used very often:
https://codesearch.wmcloud.org/search/?q=RandomImageGenerator
But in these tests it's a serious bottleneck. For no good reason. We
don't really care how an image looks like during a test. Nobody will
ever see it. Not even when a test fails.

Bug: T225730
Change-Id: I7f3d586144ecdf480c773dc5e8b10f1ad4df8861
2024-09-05 19:48:36 +00:00
Umherirrender
ca8b1eb476 Add missing documentation to class properties (frontend-related)
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Id75cb2e5fbee0fe7600f92473d876f23730d46b7
2024-09-05 21:41:19 +02:00
Máté Szabó
f89aa38f69 objectcache: Remove WinCache support
WinCache is an APCu equivalent for use with Microsoft IIS, but in recent
years has been unmaintained and lacks support for PHP 8 and newer.[1]
So, remove support for it as MediaWiki will be raising the minimum
supported PHP version to 8.1.

[1] https://www.php.net/manual/en/install.windows.recommended.php

Bug: T365691
Change-Id: I4d2dc01a9119bb1f858132f0146b894750c1e86d
2024-09-05 17:59:26 +00:00
Fomafix
b43860cc09 Add new hook OutputPageRenderCategoryLink
This allows to change the category link rendering by extension
CategoryTree without missing update of mCategoryData and mCategories
which leads to wgCategories = [] (T372155).

The new hook will be used in extension CategoryTree by
Ic86f210474cbc0e2dcebf664cf2309a4a4408f60.

Bug: T372155
Change-Id: Id82a77a57d1f12233d974ea4c1b093f50c5ab74f
2024-09-05 15:53:43 +00:00
jenkins-bot
9722ca09d7 Merge "Hide Special:UserRights link in tools menu when user is a temp user" 2024-09-05 11:58:06 +00:00
Dreamy Jazz
aaacde27b6 Hide Special:UserRights link in tools menu when user is a temp user
Why:
* The "Tools" menu contains a link to Special:UserRights.
* In 4da1989b63 this was updated to
  not display the "Change user groups" link for a temporary user
* However, we should also hide the link for a temporary account.

What:
* Update Skin::buildNavUrls to not add the link to
  Special:UserRights if the user is a temporary account.

Bug: T373988
Change-Id: Ib7d94c6cd5fb213c2bac7b55b8e77c4930e8f5d3
2024-09-05 12:05:20 +01:00
jenkins-bot
7ffa04d155 Merge "Remove UIDGenerator, deprecated since 1.35" 2024-09-05 11:01:25 +00:00
jenkins-bot
3ff7fbbdfa Merge "upload: Add missing documentation to class properties" 2024-09-05 07:03:13 +00:00
jenkins-bot
4a95543279 Merge "Storage: Remove transaction cancel callback from NameTableStore" 2024-09-04 23:54:56 +00:00
jenkins-bot
1062845a48 Merge "objectcache: Remove ReplicatedBagOStuff, deprecated since 1.42" 2024-09-04 20:49:48 +00:00
Ebrahim Byagowi
c0d1f7694c objectcache: Remove ReplicatedBagOStuff, deprecated since 1.42
Bug: T352481
Change-Id: I4e1ee5680b7ba0207dfe30a1208db35eca07e218
2024-09-04 20:21:29 +00:00
Hannah Okwelum
70e0417c2d Resourceloader: Enable methods that stores and retrieves dependency during test
This was intially disabled in I6c54466e9517d98. Now we use HashBagOStuff during test which doesn't use any database interaction.
So it's okay to enable them now.

Bug: T343492
Change-Id: I0413fc9e302085f27ea9e00eafee23858126426b
2024-09-04 20:15:03 +00:00
Umherirrender
bc1af02d62 upload: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I07ce1f37d1bfb18d6e73dd008a712b3ca60a80e9
2024-09-04 20:09:32 +00:00
jenkins-bot
d15ce4589e Merge "Make SpecialUserRights::userCanChangeRights not accept temp users" 2024-09-04 18:40:50 +00:00
jenkins-bot
8c683a26bd Merge "Prevent cross-wiki assignment of groups to temporary accounts" 2024-09-04 18:36:37 +00:00
Dreamy Jazz
4da1989b63 Make SpecialUserRights::userCanChangeRights not accept temp users
Why:
* SpecialUserRights::userCanChangeRights is used by
  Skin::buildNavUrls to determine whether to display a link to
  Special:UserRights for a user
* Special:UserRights does not allow temporary accounts, so the
  aformentioned method should return false if the name is a
  temporary account to not add the navigational link.

What:
* Return false from SpecialUserRights::userCanChangeRights if the
  provided target user is a temporary account.
* Add some tests for SpecialUserRights::userCanChangeRights to
  verify this behaviour.

Bug: T373988
Change-Id: Ib960c0ae0a04650acfb17d273389f151a04672a2
2024-09-04 15:18:54 +00:00
Dreamy Jazz
b4ce1e3f05 Prevent cross-wiki assignment of groups to temporary accounts
Why:
* On wiki farm installs, it is possible that temporary accounts
  are enabled on wiki but not another wiki
* Special:UserRights can assign groups to users on other wikis
* This currently allows temporary accounts to be assigned groups
  from a wiki where the feature is disabled and not known.
* The Special:UserRights page should disallow this by preventing
  cross-wiki assignment of rights when the target username is
  reserved by the temporary accounts system.
** This works because the reserved pattern is accessible even when
   the feature is not known
** Furthermore, the reserved pattern is expected to be set for all
   wikis in the farm if one wiki has temporary accounts enabled,
   so that the temporary account cannot be created on wikis which
   have the feature disabled.

What:
* Update SpecialUserRights::saveUserGroups and ::fetchUser to
  reject usernames when:
** The wiki ID for the username is not local
** Temporary accounts are not enabled on the wiki
** TempUserConfig::isReservedName returns true for the username
* Add a test to verify that temporary accounts cannot be given
  user groups by the special page.
* Testing the changes made in this commit will be difficult as it
  requires having a second wiki set up, and this is not done in
  CI (which makes the test non-blocking for CI).

Bug: T372046
Change-Id: I2d60c5b3322caa4629b4e73c0b0b525fd1028946
2024-09-04 15:26:25 +01:00
Amir E. Aharoni
3353abe82c Add plural forms for Levantine Arabic
Bug: T363690
Change-Id: I9d451e1fa53424ccccb1ef0df21e28fc1d2cfdf4
2024-09-04 13:35:57 +00:00
Ebrahim Byagowi
f903bae012 Remove UIDGenerator, deprecated since 1.35
Change-Id: I5e47ecd560218df7e48af68e6aee351bc2a57823
2024-09-04 14:38:30 +03:30
jenkins-bot
2a9b9675e2 Merge "build: Use inline ignore for Generic.CodeAnalysis.AssignmentInCondition" 2024-09-04 11:07:40 +00:00
jenkins-bot
5e258de06e Merge "tests: Use const for some static data in test files" 2024-09-04 00:51:07 +00:00
jenkins-bot
45e790aa69 Merge "Indicate IP contributions are legacy when temporary accounts enabled" 2024-09-03 23:23:38 +00:00
jenkins-bot
3b1c9bca23 Merge "Expand ProtectTest" 2024-09-03 18:37:46 +00:00
jenkins-bot
0feebaab4e Merge "Test validateRegistrationFile.php" 2024-09-03 17:13:20 +00:00
jenkins-bot
f6c944ce54 Merge "Test changePassword.php" 2024-09-03 16:44:40 +00:00
jenkins-bot
02ccf6f6a7 Merge "Test makeTestEdits.php" 2024-09-03 16:44:32 +00:00
jenkins-bot
79e3c005ac Merge "Test parse.php" 2024-09-03 16:20:44 +00:00
jenkins-bot
c33e2c3b16 Merge "Test getReplicaServer.php" 2024-09-03 16:20:36 +00:00
jenkins-bot
f48e9e34a8 Merge "Test runJobs.php" 2024-09-03 16:15:06 +00:00
jenkins-bot
e51961ecc2 Merge "Test LoggedUpdateMaintenance" 2024-09-03 15:23:30 +00:00
jenkins-bot
c029c7a891 Merge "auth: Split TemporaryPasswordPrimaryAuthenticationProviderTest cases" 2024-09-03 13:53:17 +00:00
Dreamy Jazz
b1c13e3dfb Test LoggedUpdateMaintenance
Why:
* The LoggedUpdateMaintenance class is not tested and testing it
  will help avoid regressions/bugs.

What:
* Create LoggedUpdateMaintenanceTest

Bug: T371167
Change-Id: I84f5399bf67cc98d7c731d75ee668481ce0817b2
2024-09-03 10:21:04 +01:00
Umherirrender
c28ffec986 tests: Use getNewTempFile to simplify test setup
Avoid own teardown as MediaWikiIntegrationTestCase tracks the file and
delete the file on teardown

Remove unused tempnam (added unused in 3db119428a)

Change-Id: Ic53398c89c885f1c263dfcdbc59f6129f605f5a7
2024-09-02 21:14:48 +02:00
jenkins-bot
ea7005551f Merge "search: Replace IResultWrapper::fetchObject()/next() with foreach loop" 2024-09-02 18:42:38 +00:00
Máté Szabó
b9a7704e54 auth: Split TemporaryPasswordPrimaryAuthenticationProviderTest cases
Why:

- TemporaryPasswordPrimaryAuthenticationProviderTest currently combines
  multiple test cases within a single test method, leading to
  duplication and making the tests harder to grok.

What:

- Split the test cases within the test class to use either data
  providers or separate methods where the inputs cannot be provided via
  a data provider.
- Make getProvider() stateless and initialize the $manager and $validity
  fields unconditionally via a setup hook to avoid confusing null errors
  if attempting to manipulate these fields prior to obtaining a provider
  instance.

Bug: T328718
Change-Id: I3e53d06ec5bde6a8f842f5caed5cdbad883f7afd
2024-09-02 16:52:23 +02:00
Dreamy Jazz
c9ce78ce7c Expand RollbackEditsTest
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
* Some files are mostly covered, and expanding their associated
  tests should fully cover them or at least further improve
  coverage.

What:
* Expand RollbackEditsTest

Bug: T371167
Change-Id: I852f5ecb8f316138f0dc8196dc0999f35d0ec093
2024-09-02 12:34:17 +00:00
Dreamy Jazz
18285ec027 Test grep.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Fix grep.php to batch requests for rows from the page table,
  as it currently selects all rows in one go.
** Doing this on large wikis would result in millions of rows
   being returned in one query.
* Create GrepPagesTest

Bug: T371167
Change-Id: I4c9a55257ee64609fece776ca15c4219764d5266
2024-09-02 11:53:46 +00:00
Dreamy Jazz
e90e109f33 Test alltrans.php and dumpMessages.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create a MockLocalisationCacheTrait which is used to generate
  a mock LocalisationCache instance which has a limited and fixed
  set of message keys
** This is created by splitting code from LocalisationCacheTest
* Create AllTransTest and DumpMessagesTest which make use of this
  new trait.

Bug: T371167
Change-Id: Ie814c8136504d2af94ec9377d64b19d3a0e25eed
2024-09-02 11:52:54 +00:00
Dreamy Jazz
259df3af53 Move BenchmarkerTest and MaintenanceTest into includes folder
* The tests/phpunit/maintenance folder is getting quite long
  and moving some tests to folders where possible would help
  with this
* The BenchmarkerTest and MaintenanceTest classes are associated
  with classes that are in an includes folder, so moving them
  is possible.
* While moving MaintenanceTest, expand the tests for the class.

Bug: T371167
Change-Id: I7623470c244f228d7cc1da33b0bf135038732632
2024-09-02 11:52:20 +00:00
Dreamy Jazz
cad3bd1703 Test changePassword.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create ChangePasswordTest

Bug: T371167
Change-Id: Ia61283e4121f1130607ba103202e2e1a500f1cb2
2024-09-02 11:49:00 +00:00
Dreamy Jazz
c38ce01267 Test makeTestEdits.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create MakeTestEditsTest which fully tests the script

Bug: T371167
Change-Id: If71c09eea96c4b0fbf522162de3a5ed09a5770f6
2024-09-02 10:20:02 +00:00
Dreamy Jazz
33a191b20d Expand MigrateUserGroupTest
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
* Some files are mostly covered, and expanding their associated
  tests should fully cover them or at least further improve
  coverage.

What:
* Expand MigrateUserGroupTest

Bug: T371167
Change-Id: I3c40317988f822e077634cf63ab292df7ef66806
2024-09-02 10:16:56 +00:00
Dreamy Jazz
7c4710da7d Expand GetTextMaintTest
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
* Some files are mostly covered, and expanding their associated
  tests should fully cover them or at least further improve
  coverage.

What:
* Expand GetTextMaintTest

Bug: T371167
Change-Id: I8667396cd8c16116ed9f885bf72c7b197c9fdd86
2024-09-02 10:16:21 +00:00
Dreamy Jazz
5a5a28f817 Expand ProtectTest
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
* Some files are mostly covered, and expanding their associated
  tests should fully cover them or at least further improve
  coverage.

What:
* Expand ProtectTest

Bug: T371167
Change-Id: Iff86988967d8a69d71353fea4ba72705062aa95f
2024-09-02 10:16:03 +00:00
Dreamy Jazz
ef978569f8 Expand ResetUserEmailTest
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
* Some files are mostly covered, and expanding their associated
  tests should fully cover them or at least further improve
  coverage.

What:
* Expand ResetEmailUserTest

Bug: T371167
Change-Id: I3f15f7e96c58115c245ad24fe4f1334682534354
2024-09-02 10:15:44 +00:00
Dreamy Jazz
5f3826d19f Expand CleanupWatchlistTest
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
* Some files are mostly covered, and expanding their associated
  tests should fully cover them or at least further improve
  coverage.

What:
* Expand CleanupWatchlistTest

Bug: T371167
Change-Id: I245c5550b3759d2267a89a5f81e34bec3fb97f24
2024-09-02 10:14:25 +00:00
Dreamy Jazz
477168c8c9 Test validateRegistrationFile.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create ValidateRegistrationFileTest

Bug: T371167
Change-Id: Icba4650a0d3f6af3d597628753af292f522e5456
2024-09-02 10:12:00 +00:00
Dreamy Jazz
955a81b592 Start on tests for updateExtensionJsonSchema.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create UpdateExtensionJsonSchemaTest which partly tests the
  script.

Bug: T371167
Change-Id: I289147cdcede17071e80c878fd956f4069b643c2
2024-09-02 10:11:45 +00:00
Dreamy Jazz
887af5edcd Start on tests for userOptions.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create UserOptionsMaintenanceTest which starts on tests for this
  script.

Bug: T371167
Change-Id: I51374a96a0dd73f5a155278f5a48c5b59c44d055
2024-09-02 10:10:20 +00:00
Dreamy Jazz
845e73f80c Test parse.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create CLIParserTest which does not yet test parsoid parsing
  using the script.

Bug: T371167
Change-Id: I8852d9c9889e7bfef814ce28ef7d6efe375095e2
2024-09-02 10:09:34 +00:00
Dreamy Jazz
23ab9f7005 Test runJobs.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create RunJobsTest

Bug: T371167
Change-Id: I478c23440e4b0b373e9be41dee37de6460e7962e
2024-09-02 10:09:20 +00:00
Dreamy Jazz
856da14475 Test getReplicaServer.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create GetReplicaServerTest

Bug: T371167
Change-Id: I24fdda83c8a9c2ea0ad1dbbd1f9c90bb61a81439
2024-09-02 10:08:41 +00:00
Umherirrender
0a69e0bc53 tests: Use const for some static data in test files
Change-Id: Id7ccd48e3bf626095e2d3929831b5d87ed0be948
2024-09-01 23:24:11 +02:00
jenkins-bot
53936dc79c Merge "utils: Add missing documentation to class properties" 2024-09-01 15:19:10 +00:00
Umherirrender
574e8b702c utils: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Improve a mixed type to string

Change-Id: Id994553eaeac181775ac782423ff53928ad45466
2024-09-01 14:40:01 +00:00
jenkins-bot
104e1c05c8 Merge "filerepo: Add missing documentation to class properties" 2024-09-01 13:42:26 +00:00
Umherirrender
20dadba5be filerepo: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Ifbc2ce0c68865c5d32689e56c6215a5099f7478b
2024-09-01 12:09:37 +00:00
Umherirrender
e44aee1f74 auth: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Ib6081f5519d2294bb14f81bf399f9c45315f2b69
2024-09-01 11:27:45 +02:00
Umherirrender
be39a18332 build: Use inline ignore for Generic.CodeAnalysis.AssignmentInCondition
Avoid that new code contains this pattern.

Depends-On: I7a9b5c89129fe4b555d03861f2c3ce3e9e2b2446
Depends-On: Ic2bcc7eeb16d3333dcd019bd209bd7fde843dab9
Depends-On: If20eddd8376ae2e8e29c4e56cd51f7b8eb6642b0
Depends-On: I3414f7e17f4bcb801857bc986bae8eb97aa2bfb8
Depends-On: I38b2729418e8389c681c6cd84858f5e5ed25bd3e
Change-Id: I7cfd2e027edd327cf8be6471e348c137fefacda0
2024-09-01 00:15:10 +02:00
Umherirrender
cfa2cf73ff search: Replace IResultWrapper::fetchObject()/next() with foreach loop
Avoid assigment in conditions
foreach starts at begin of iterator, the while loop can process the next
from within the result, but all the iterator in search are rewinded
before iterator starts

Change-Id: I38b2729418e8389c681c6cd84858f5e5ed25bd3e
2024-08-31 23:58:02 +02:00
jenkins-bot
684496b621 Merge "Message: Add more tests for serialization and unserialization" 2024-08-30 22:13:07 +00:00
Bartosz Dziewoński
087e676cea Message: Add more tests for serialization and unserialization
Bug: T373719
Change-Id: I153b9ba9edf67d940ef6c7b1ab1fe9f806e534d7
2024-08-30 17:47:33 -04:00
jenkins-bot
9ba29602e7 Merge "tests: Remove deprecated MediaWikiIntegrationTestCase::addCoreDBData" 2024-08-30 21:38:53 +00:00
Amir Sarabadani
505bd8e70f Storage: Remove transaction cancel callback from NameTableStore
What it's trying to achieve can be done much simpler by just making an
out of transaction connection via setting CONN_TRX_AUTOCOMMIT flag.

Removing this allows us to get rid of a large portion of transaction
management in rdbms library as this is the only place that uses cancel
callbacks.

Split out of I3cb1e30611b83c0

Bug: T372169
Change-Id: Idad029b6da6b09e084d466d282ef1145ebd8fe73
2024-08-30 20:41:08 +00:00
jenkins-bot
750aa11700 Merge "Start on tests for install.php" 2024-08-30 20:17:55 +00:00
jenkins-bot
c188ff067e Merge "Fully test createBotPassword.php" 2024-08-30 20:17:48 +00:00
jenkins-bot
614c47f905 Merge "Test deleteOrphanedRevisions.php" 2024-08-30 20:14:38 +00:00
jenkins-bot
b40cef955f Merge "Test dumpRev.php" 2024-08-30 20:14:29 +00:00
jenkins-bot
7eaeffdbfe Merge "Test fixUserRegistration.php" 2024-08-30 20:14:20 +00:00
jenkins-bot
5984c36efd Merge "Start on tests for renameUser.php" 2024-08-30 20:14:09 +00:00
Dreamy Jazz
bcb2112850 Start on tests for install.php
Why:
* Maintenance scripts in core are mostly untested and testing them
  will help to avoid regressions.

What:
* Create CommandLineInstallerTest.

Bug: T371167
Change-Id: Ia9ef03326d7c25b7eb310c191034932fffcbff8c
2024-08-30 19:44:52 +00:00
Dreamy Jazz
a805898fa1 Fully test createBotPassword.php
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs

What:
* Create CreateBotPasswordTest which fully tests
  createBotPassword.php maintenance script.
* While doing this, address a PHP warning that appears when the
  user does not specify the 'grants' option.

Bug: T371167
Change-Id: I8256c278b8397de896906e5714d478883b518ba0
2024-08-30 19:18:23 +01:00
C. Scott Ananian
132de675ce Add tracking category resolution to Parsoid DataAccess
This allows Parsoid to add tracking categories, even though
the exact name of the categories is resolved by mediawiki
core.

Change-Id: Id4b29c6d09c79649c94d2da2e678af52a967bbe5
2024-08-30 14:08:38 -04:00
Dreamy Jazz
0a89e2b019 Test deleteOrphanedRevisions.php
Why:
* Maintenance scripts in core have a low percentage of test coverage
* Testing these scripts helps avoid regressions and bugs

What:
* Create DeleteOrphanedRevisionsTest which fully tests the
  maintenance script.

Bug: T371167
Change-Id: I759a9203c52fd00cdeb5effe38f01190dec1fc80
2024-08-30 18:07:43 +00:00
Dreamy Jazz
cf089f77ff Test dumpRev.php
Why:
* Maintenance scripts in core have poor test coverage
* Improving this coverage will help reduce the chances of bugs
  and regressions.

What:
* Create DumpRevTest which mostly covers dumpRev.php

Bug: T371167
Change-Id: I0707bd92abb8b39e257b97aafdadef6bc600bee2
2024-08-30 16:59:00 +00:00
Dreamy Jazz
05c7a34fa6 Test fixUserRegistration.php
Why:
* Maintenance scripts in core are mostly untested and testing them
  will help to avoid regressions.

What:
* Create FixUserRegistrationTest that fully tests the associated
  maintenance script.

Bug: T371167
Change-Id: Ifb3594f7dc0055568431002a9180df7db4da9692
2024-08-30 17:39:11 +01:00