Commit graph

17505 commits

Author SHA1 Message Date
jenkins-bot
a4a53d00ac Merge "status: Log getMessage()/getWikiText() calls on good Statuses" 2024-10-06 09:53:02 +00:00
Ebrahim Byagowi
b7ce4a4341 Use getContentLanguage() in two special pages instead of injection
Change-Id: I24aab0ee13353bb29eb5fbb3d68ebc9389d5321f
2024-10-05 20:08:43 +03:30
jenkins-bot
c09ac42243 Merge "build: Use inline ignore for MediaWiki.Usage.DeprecatedGlobalVariables" 2024-10-05 15:59:19 +00:00
Yiannis Giannelos
fec9daae4e Use statslib for metrics emitted by HtmlOutputRendererHelper
Bug: T359476
Change-Id: If8bc5a7f7383dcb67dadf1f4c02d1b69d7c8fa53
2024-10-04 14:52:30 -04:00
Máté Szabó
a5049b481f status: Log getMessage()/getWikiText() calls on good Statuses
Why:

- Calling getMessage()/getWikiText() with a good Status is a logic error
  that converts the Status being operated on into a fatal one.
- However, this error is never logged anywhere, which can make it
  difficult to diagnose such cases, as seen in
  I17166e988bf389a5b03d4a74f539f7bec7f5997f.

What:

- Add a warning-level log for the case when getMessage() or
  getWikiText() is invoked with a good Status.

Bug: T374436
Change-Id: I3efae5c4c336156924f1c9b4186fa9142aaed9ca
2024-10-04 18:32:24 +02:00
jenkins-bot
8f8677e2c0 Merge "Use a better bidi aware markup in CommentParser" 2024-10-04 12:21:17 +00:00
Ebrahim Byagowi
efda4cae32 Use a better bidi aware markup in CommentParser
As noted on the comments, this needed a markup that work better
in bidi scenarios and as a part of replacing bidi control codes
with HTML markup I was able to test different bidi scenarios
using <bdi> HTML tags.

Bug: T375975
Change-Id: If2af751fc9f78869acf7b7e93199fa927de2cc19
2024-10-04 10:50:02 +03:30
Ebrahim Byagowi
bc7ec83596 Remove CommentFormatter::formatStringsAsBlock
This doesn't seem to be used anywhere except the tests and the
better API is to use $formatter->createBatch() API that
doesn't expose 'ugly boolean parameters' as described by
formatInternal method above so let's remove it.

https://codesearch.wmcloud.org/search/?q=formatStringsAsBlock

Change-Id: Ia7428f5dbdf6c76b7537ae3889aef077bb26c722
2024-10-04 10:23:17 +03:30
James D. Forrester
91a37f53b4 Switch over a bunch of class_alias uses to actuals
Change-Id: Id175a83e71cc910eaee5d5890a9106872a3ca3b8
2024-10-03 17:09:36 +00:00
James D. Forrester
9203493606 Add namespace to remaining parts of Wikimedia\FileBackend
Bug: T353458
Change-Id: I49c843c9d8f6459c0fbf774afeea7a82fa564b59
2024-10-03 16:21:22 +00:00
jenkins-bot
c35a006fe6 Merge "Use import actor store where needed in RC categorisation" 2024-10-03 15:30:13 +00:00
jenkins-bot
4627fe60af Merge "Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\Stats" 2024-10-03 14:16:24 +00:00
jenkins-bot
db7ee3db99 Merge "Add namespace to remaining parts of Wikimedia\ObjectCache" 2024-10-03 14:02:47 +00:00
jenkins-bot
a8394fc87f Merge "rdbms: avoid pcre.backtrack_limit in QueryBuilderFromRawSql::generalizeSQL()" 2024-10-02 17:34:08 +00:00
jenkins-bot
a80da8eacf Merge "resourceloader: Add/change ResourceLoaderModifyEmbeddedSourceUrls hook" 2024-10-02 16:12:30 +00:00
Dreamy Jazz
649b0f4954 Use import actor store where needed in RC categorisation
Why:
- When temporary users are enabled, creating IP actors is disallowed
  apart from specific cases, such as importing revisions authored by
  anonymous users.
- If such a revision includes a category link and
  wgRCWatchCategoryMembership is true, MediaWiki will fire a job to
  create a corresponding RC entry, which will attempt to attribute the RC
  to the anonymous IP that authored the imported revision and fail in
  doing so.

What:
- Track whether a category membership change job was triggered by an
  import, and allow RecentChange objects created by such jobs to create
  anonymous actors.

Test Plan:
 1. On a wiki with temporary accounts enabled and wgRCWatchCategoryMembership = true,
    import a revision via Special:Import that was authored by an anonymous user
    and contains a category link.
 2. Verify that the import succeeds and that the corresponding RC entry
    shows up.

Bug: T373318
Change-Id: I89abdca9c4ab8796a211df8b37c1bd7173a496e5
2024-10-02 00:45:22 +02:00
Aaron Schulz
9508801cc7 rdbms: avoid pcre.backtrack_limit in QueryBuilderFromRawSql::generalizeSQL()
Add some unit tests for this method.

Bug: T366640
Change-Id: I466c83a8d2b8fabcd4c30eb079273dfd52a31b71
2024-10-01 12:00:44 -07:00
jenkins-bot
3fc0aaa963 Merge "rdbms: improve Database::flushSnapshot() to use ROLLBACK sometimes" 2024-10-01 01:10:36 +00:00
jenkins-bot
0b58fa9602 Merge "installer: Consistently use double quotes when outputting settings" 2024-09-28 10:50:24 +00:00
Aaron Schulz
b6b2c9d0c9 rdbms: improve Database::flushSnapshot() to use ROLLBACK sometimes
In case a DB handle ends up in STATUS_TRX_ERROR, use "ROLLBACK" so
that assertQueryIsCurrentlyAllowed() does not complain.

Also improved related Database::assessConnectionLoss() comments.

Change-Id: I39cee1363496dfe29e268a219b39070b23fdee4c
2024-09-27 16:28:48 -07:00
jenkins-bot
315de0e434 Merge "Deduplicate language links in ParserOutput and OutputPage" 2024-09-27 22:43:43 +00:00
James D. Forrester
cc28acc455 Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\Stats
Bug: T353458
Change-Id: If0137003ab625017d322d57870448a02569668c3
2024-09-27 16:19:10 -04:00
James D. Forrester
53b67ae0a6 Add namespace to remaining parts of Wikimedia\ObjectCache
Bug: T353458
Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
2024-09-27 16:19:10 -04:00
James D. Forrester
9e5c1e8ac7 Add namespace to IDBAccessObject and DBAccessObjectUtils
Bug: T353458
Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
2024-09-27 16:19:10 -04:00
Bartosz Dziewoński
531ba3aad0 resourceloader: Add/change ResourceLoaderModifyEmbeddedSourceUrls hook
We've discovered some new requirements.

Follow-up to 31f614f732.
The hook was not in a release yet, so we can rename it.

Bug: T371530
Change-Id: I82d8ae69c27a38c45eab5d19c063f0b9515b8ec8
2024-09-27 20:28:30 +02:00
Bartosz Dziewoński
e8ed75ea19 MockServiceDependenciesTrait: Allow override param to be null
Change-Id: Ib59455882f703f4473f1ff2d14dc3d8a7caa034e
2024-09-27 18:28:33 +02:00
Máté Szabó
3263182512 installer: Consistently use double quotes when outputting settings
Why:

- The installer feeds several user-provided values, such as the site
  name, directly into LocalSettingsGenerator.
- There, these get passed through escapePhpString(), the output of which
  is safe when rendered into a double-quoted string, but fails if the
  input string contained single quotes and was rendered into a
  single-quoted string.

What:

- Consistently output all strings in LocalSettingsGenerator as
  double-quoted strings.

Bug: T372569
Change-Id: I27bb3c31d8e9957b4880d0faba8b79d121126a11
2024-09-27 14:53:46 +02:00
jenkins-bot
3390d72f2f Merge "rdbms: make LBFactory::waitForReplication() always run the callbacks" 2024-09-26 23:07:25 +00:00
C. Scott Ananian
7495f9bc15 Deduplicate language links in ParserOutput and OutputPage
Move deduplication of language links out of Parser.php and into the
ParserOutput in order to be compatible with alternate Parsers (Parsoid).
Clean up various inconsistencies: ensure deduplication also happens in
OutputPage when multiple ParserOutputs are merged into the final output,
and ensure that the deduplication in LinksUpdate is done in the same
order (first link prevails) as in Parser/ParserOutput/OutputPage.

Deprecate OutputPage::setLanguageLinks() (the matching
ParserOutput::setLanguageLinks() was deprecated in 1.42).

As a breaking change, return an array, not an array *reference*, from
ParserOutput::getLanguageLinks().  This allows us to safely modify the
internal representation of language links. As far as I can tell, no one
used the returned reference to sneakily modify the list of language
links, and there not a good way to have deprecated this before making
the breaking change.

While we're at it, we've added tests to ensure that language link
fragments are preserved.

Bug: T26502
Bug: T358950
Bug: T375005
Change-Id: I82a05a51d94782ebb9fa87ff889ca0f633b3e15c
2024-09-26 15:28:49 -04:00
Umherirrender
c7cd5399e7 build: Use inline ignore for MediaWiki.Usage.DeprecatedGlobalVariables
This avoids addition of new code with the deprecated global,
or at least it gives extra attention on review when new code also uses
the inline ignore

Change-Id: I5c1bc5a1685c28f153d4fbe3525959930f54b557
2024-09-26 18:15:32 +00:00
jenkins-bot
3878a20119 Merge "tests: Pass no arguments to getDefaultWikitextNS" 2024-09-26 17:15:25 +00:00
James D. Forrester
984076f98e Add namespace to includes/api classes
Bug: T353458
Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
2024-09-25 19:31:14 +00:00
Umherirrender
f5d4cf2654 tests: Pass no arguments to getDefaultWikitextNS
Change-Id: Ie57047dea892f74b5d83858d3b292963f45b14f2
2024-09-25 18:01:12 +02:00
James D. Forrester
30458987e2 tests: Consistently use class_alias comments like elsewhere
Found via `[^*][^\\]\nclass_alias`.

Change-Id: I9732f75226445f48fb131c432b209d0fd3eba1ba
2024-09-25 09:48:46 -04:00
jenkins-bot
57e35810a3 Merge "Send temporary accounts to Special:CreateAccount on ::requireNamed" 2024-09-24 22:57:16 +00:00
jenkins-bot
6aff64e157 Merge "ResourceLoader: Fix content-links compat" 2024-09-24 22:17:54 +00:00
Dreamy Jazz
0fa81768c2 Send temporary accounts to Special:CreateAccount on ::requireNamed
Why:
* When code throws a UserNotLoggedIn error for a temporary account,
  this takes them to Special:UserLogin and asks them to log in to
  an account
* Users using temporary accounts are less likely to have a named
  account, so should instead be sent to Special:CreateAccount
  (as described in T358586)
* When doing this, the warning message should be customised to
  talk about the user needing to create an account (and not
  log in)

What:
* Update UserNotLoggedIn to redirect to Special:CreateAccount
  when the user is logged in to a temporary account
** The code which constructs the exception object can override
   this and force the redirect to always be to Special:UserLogin.
* When the redirect is to Special:CreateAccount, allow customising
  the message shown by adding a '-for-temp-user' suffix to the
  message key in UserNotLoggedIn.
** This suffix is only added if the resulting message exists,
   so that code can choose whether they need a message that is
   different to the one on Special:UserLogin.
* Update SpecialPage::requiredNamedUser to allow special pages to
  force the redirect to always be to Special:UserLogin
** This is made use of in Special:ChangeEmail and
   Special:ConfirmEmail, as these special pages only make sense
   for use with an existing account.
* Update and add message keys to allow a different message for
  Special:CreateAccount.
* Update and add tests for these changes.

Bug: T358586
Change-Id: Ie0dd06f51b1e2b85eef6be377f673a02732ce604
2024-09-24 21:42:17 +00:00
jenkins-bot
fafcfba353 Merge "nametablestore: simplify NameTableStore::acquireId() and update comments" 2024-09-24 20:49:22 +00:00
Aaron Schulz
8a2776ed81 nametablestore: simplify NameTableStore::acquireId() and update comments
Make store() handle cache purging upon new ID insertion and fetching
of the winning ID when raced out. This avoids the reloadMap() call.

Remove connection flag hack in reloadMap() given 0cb0f0ba7.

Remove comments about retryStore() logic removed in 505bd8e70f.

Clean up return types for the ID:name arrays.

Change-Id: Ic57eb5e2b59da67c6511b935d9e68ffb595028fa
2024-09-24 16:55:22 +00:00
jenkins-bot
ef345c078c Merge "Add SpreadAnyEditBlock hook" 2024-09-24 12:16:21 +00:00
Dreamy Jazz
6547b639d8 Add SpreadAnyEditBlock hook
Why:
* A hook is needed which is called when User::spreadAnyEditBlock
  is called, so that extensions which provide alternative blocking
  mechanisims (such as the GlobalBlocking extension) can spread
  their blocks when local blocks are spread.

What:
* Add SpreadAnyEditBlockHook which is called from User
  ::spreadAnyEditBlock when it is called except when the user is
  not registered.
** The hook is called even if the user is not locally blocked
* The return value of User::spreadAnyEditBlock is modified to
  return true if either a local block or alternative blocking
  mechanism spread blocks.
* Update UserTest to test this new behaviour.

Bug: T374857
Change-Id: Id302a6362d6177c89da9cdf4e677b3822ecb85f1
2024-09-24 12:04:20 +01:00
jenkins-bot
ef41dedbd4 Merge "objectcache: Add regression test for MultiWrite dependency injection" 2024-09-24 04:38:56 +00:00
Timo Tijhof
70f9eb8f91 objectcache: Add regression test for MultiWrite dependency injection
Follows-up 4e596f5112 (I59266726ad), which fixed bug T318272, but
did not add a regression test for it.

Bug: T318272
Bug: T327158
Change-Id: Ia8af6671887d3914fdc761d8e5d10fd33fb40f88
2024-09-23 15:07:23 -07:00
jenkins-bot
8143b783be Merge "mediawiki.special.block: make submit destructive and use old messages" 2024-09-23 21:35:47 +00:00
Jon Robson
65c0b0ac60 Drop legacy classes from HTML message box output
The use of this markup is triggering the loading of mediawiki.legacy.messageBox
and deprecation notices on all pages that use the Html method.

Bug: T360668
Depends-On: I4bd1a8a9d4eda1b3e89d067d6671d3f8bad4f584
Change-Id: I0195d4b0f790f6595cc626a6db96b4fc6380a0f4
2024-09-23 17:33:35 +00:00
jenkins-bot
eb5e5afb5c Merge "SpecialBlock: Make private function getTargetAndTypeInternal non-static" 2024-09-21 18:24:24 +00:00
Fomafix
2a6782be70 SpecialBlock: Make private function getTargetAndTypeInternal non-static
This allows to access $this->blockUtils.

Also make the parameter WebRequest $request mandatory. because it is
already always present.

Change-Id: I97d5af0c5b1f54c4bd666183ae98199aa576596e
2024-09-21 15:22:41 +00:00
jenkins-bot
b145754452 Merge "tests: Use ::class for class name resolution" 2024-09-21 13:48:10 +00:00
Umherirrender
8e039f2101 tests: Use ::class for class name resolution
Also use namespaced version of the class

Change-Id: Idce009e4d0a8e77f95244d95db008d64a2025c5f
2024-09-20 21:19:22 +02:00
daniel
84fe1b9ccd REST: Introduce discovery endpoint
The discovery endpoint provides basic information about accessing the
wiki's APIs, as well as a directory of available modules.

Bug: T365753
Change-Id: I161aa68566da91867b650e13c8aadc87cd0c428c
2024-09-20 17:02:59 +00:00