Commit graph

419 commits

Author SHA1 Message Date
Bartosz Dziewoński
43c6ae92f7 Revert "Add option to show experimental login popup links"
This reverts commit 9b8d4fc6e1.

Bug: T367891
Change-Id: I1b51a56755f7c6123c0b065abef15efd935169fa
2024-06-18 16:13:54 +00:00
C. Scott Ananian
105bb58ae2 [ParsoidCachePrewarmJob] Use ParserOutputAccess
One more step in gradually replacing uses of ParsoidOutputAccess.  This
one was pretty easy, as ParsoidOutputAccess was pretty much directly
calling ParserOutputAccess when provided with a ExistingPageRecord
and RevisionRecord.

Bug: T367074
Change-Id: I96161a64952e1809c0aec773d5a3dd4c71105657
2024-06-17 13:24:39 +00:00
jenkins-bot
9cb183acd7 Merge "[temp accounts] Introduce 'known' config flag" 2024-06-14 14:32:10 +00:00
jenkins-bot
286f49b678 Merge "Add Special:RestSandbox for exploring REST API" 2024-06-14 01:19:30 +00:00
Thalia
2c3b456ffc
[temp accounts] Introduce 'known' config flag
Why:

- We want to distinguish temp account creation being enabled from a
  configuration state where MediaWiki knows about temp accounts
  existing (and can identify and manage them accordingly) while temp
  account creation is disabled

What:

- Introduce a 'known' configuration flag to TempUserConfig
- If 'enabled' is set to true, then 'known' is automatically overridden
  to true
- If an administrator wishes to disable temp account creation after
  temporary accounts have been created, the administrator should set
  'enabled=false' and 'known=true'

Co-authored-by: Tchanders <thalia.e.chan@googlemail.com>
Co-authored-by: Kosta Harlan <kharlan@wikimedia.org>
Bug: T356524
Change-Id: I4ce534a847461230f7fa276a565bdc1d6c9857e1
2024-06-13 22:11:27 +02:00
daniel
c01b7c7b4b Add Special:RestSandbox for exploring REST API
Special:RestSandbox presents a Swagger-UI interface for exploring REST APIs. The available APIs can be configured using RestSandboxSpecs.

For now, the default is to support no APIs, so the feature is disabled in production. In the future, it would make sense to expose the wiki's own REST API per default. The corresponding entry in $wgRestSandboxSpecs in LocalSettings.php would look like this:

	'mw' => [
		'url' => $wgScriptPath . '/rest.php/',
		'name' => 'MediaWiki REST API',
	]

Note that the spec URL may still change.

To also explore the endpoints exposed through RESTbase, we might add:

	'wmf-restbase' => [
		'url' => $wgServer . '/api/rest_v1/',
		'name' => 'Wikimedia RESTbase API',
	]

Similarly, we could expose a spec for endpoints on api.wikimedia.org, which could then be explored using the new special page.

NOTE: This adds a dependency on the swagger-ui npm library. See T325558 for the security review.

Bug: T362006
Change-Id: I1dd5ed82680a28f9c15136b446a2de0398525061
2024-06-13 21:40:36 +02:00
Kevin Israel
71f27d46f1 password: Remove automatic fallback to hash_pbkdf2()
The criteria for doing so have now been met:

* PHP 8.1+ is now the documented minimum, and the 1.42 branch already
  enforces this in PHPVersionCheck. (T359868)
* OpenSSL support is also now required. (e4127e5864)

As stated in AbstractPbkdf2Password::canUseOpenSSL(), the version check
is no longer needed because PHP 8.1 requires OpenSSL >= 1.0.2. While the
the master branch may still work on PHP 7.4 for now, it is unlikely that
a site using it would still have a version of OpenSSL older than 1.0.1f.
(For example, WMF stopped using Ubuntu 14.04 "Trusty", which has exactly
that minimum version of OpenSSL, once Canonical started charging for
security updates in 2019.)

The reasons for the version check were:

* Old versions of OpenSSL appeared to perform at least as well as PHP
  for reasonably long passwords (up to 128 bytes for SHA-512 hashes);
  however, they had the same DoS issue that our own implementation for
  PHP 5.3 had (see T64685). hash_pbkdf2() never had that problem.

* If PHP were to incorporate the major optimization of hashing the HMAC
  key blocks only once, then the old OpenSSL versions would actually be
  slower. So far, this has not happened.

Change-Id: I47eb1aabf3d0ae4792624f9ba1c392880d52d0b7
2024-06-08 01:06:22 -04:00
Bartosz Dziewoński
9b8d4fc6e1 Add option to show experimental login popup links
Bug: T366486
Change-Id: Ie08089ada5461cd631687b197015725aca97711c
2024-06-03 18:29:46 +02:00
Sohom
bfb2d1d920 Add protection indicators to mediawiki/core
- Add a disabled by default feature flag 'EnableProtectionIndicators'
- When the config flag is enabled, show a lock indicator at the top
of the page.
- The lock icon should be overridable by the content of the page
- The indicator has a predictable ID which could be potentially used
 to style the icon using the onwiki Common.css file.
- The lock icon by default links to https://www.mediawiki.org/wiki/Help:Protection. However
this link can be customized per wiki per protection level using a
empty message (for example: `protection-sysop-helppage`)

Bug: T12347
Change-Id: I3e36d98edfe54a9c138b1fe8e5057e107ded281b
2024-05-28 16:09:27 -04:00
jenkins-bot
ed10e9dbfb Merge "Remove TemplateLinksSchemaMigrationStage config" 2024-05-28 11:45:51 +00:00
jenkins-bot
07ece77e44 Merge "Add MediaWiki\Watchlist namespace to the related classes" 2024-05-23 23:12:10 +00:00
Timo Tijhof
a0b8e38420 SpecialContribute: Add docs to explain how it works and how to enable it
Also remove unused template data.

Change-Id: Ib6772edf2294208e20a1a7dfa9e36c8f95fee133
2024-05-23 21:55:44 +01:00
jenkins-bot
a17833c271 Merge "Add MediaWiki\Content namespace to FallbackContent{,Handler}" 2024-05-23 15:19:50 +00:00
C. Scott Ananian
a565e388f9 Move ParsoidOutputAccess::supportsContentModel() into Parsoid SiteConfig
The `supportsContentModel` method is really querying Parsoid for the
set of content models it supports, so it makes sense to put it in the
Parsoid-specific SiteConfig service.

This is part of the work to deprecate and remove ParsoidOutputAccess.

Change-Id: I81eb2df8cef93ede95361a4e03185b3d58e5b84b
2024-05-22 10:57:37 -04:00
Ebrahim Byagowi
12660db261 Add MediaWiki\Watchlist namespace to the related classes
This adds MediaWiki\Watchlist namespace to the classes of watchlist
directory and adds deprecation notice since 1.43 to the just created
unnamespaced aliases of the classes.

Bug: T353458
Change-Id: I4234f8fe62bb3bde6f5271c7ba31a2420b0f4b90
2024-05-22 01:23:10 +03:30
Ebrahim Byagowi
c556eda906 Add MediaWiki\Content namespace to FallbackContent{,Handler}
This adds MediaWiki\Content namespace to FallbackContent
and FallbackContentHandler and declares the unnamespaced version
as deprecated since version 1.43.

Bug: T353458
Change-Id: I3ee80aea379788b71539cc1c7a4ec216b753e042
2024-05-21 17:05:28 -04:00
Ebrahim Byagowi
656c7fac3b Add namespace and deprecation alias to JsonContentHandler
This patch introduces a namespace declaration for the
MediaWiki\Content to JsonContentHandler and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ia4ba6d3eddcb7b3f3d9f41a5ff80f724dbd01b22
2024-05-21 17:10:20 +03:30
jenkins-bot
cd40801020 Merge "Add namespace and deprecation alias to UDPRCFeedEngine" 2024-05-20 14:13:04 +00:00
Ebrahim Byagowi
b557846a09 Add namespace and deprecation alias to UDPRCFeedEngine
This patch introduces a namespace declaration for the
MediaWiki\RCFeed to UDPRCFeedEngine and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I27437c2417984f21e29237b011add20cad9f4389
2024-05-20 06:38:25 +03:30
Ebrahim Byagowi
16197f7d76 Add namespace and deprecation alias to TextContentHandler
This patch introduces a namespace declaration for the
MediaWiki\Content to TextContentHandler and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I2c72dacf28ee72fb70b15acdd81d0eb717ea949a
2024-05-20 05:34:31 +03:30
jenkins-bot
a66109fb5b Merge "Add namespace and deprecation alias to RedisPubSubFeedEngine" 2024-05-19 23:11:56 +00:00
Ebrahim Byagowi
8aecf94da0 Add namespace and deprecation alias to ActivityUpdateJob
This patch introduces a namespace declaration for the
Wikimedia\Watchlist to ActivityUpdateJob and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I34342bb01c8f6c9657f1b2f05de1de64a107665f
2024-05-19 21:45:47 +03:30
Ebrahim Byagowi
f060e53ec0 Add namespace and deprecation alias to RedisPubSubFeedEngine
This patch introduces a namespace declaration for the
Wikimedia\RCFeed to RedisPubSubFeedEngine and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: If5b8a0b1f957e46f29907711079389fe543941d0
2024-05-19 21:38:22 +03:30
Ebrahim Byagowi
8e5b26837b Add namespace and deprecation alias to CssContentHandler
This patch introduces a namespace declaration for the
MediaWiki\Content to CssContentHandler and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I5504c21b4fabd6ce82c4dac37aacd1c74462c41b
2024-05-19 17:01:54 +03:30
Reedy
5ab70409f5 Namespace includes/password
Bug: T353458
Change-Id: I1a701b5b7ff65356692abb0efde9a2207b6135b6
2024-05-18 16:17:38 +01:00
Ebrahim Byagowi
f0c5cd0d33 Add namespace and deprecation alias to JavaScriptContentHandler
This patch introduces a namespace declaration for the
MediaWiki\Content to JavaScriptContentHandler and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ic30789d4e80a27004b6bc3b3ba891a7332a5e1ba
2024-05-17 15:06:40 +03:30
Ebrahim Byagowi
560c0d9a96 Add namespace and deprecation alias to RenameUserJob
This patch introduces a namespace declaration for the
MediaWiki\RenameUser to RenameUserJob and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ibf7d6d54e0047c6c298c02926d8a811d26f6361c
2024-05-17 14:21:12 +03:30
Ebrahim Byagowi
bd2186338c Add namespace and deprecation alias to WatchlistExpiryJob
This patch introduces a namespace declaration for the
MediaWiki\Watchlist to WatchlistExpiryJob and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ia0a85c9d7550edc972ea512606dfcf272c71a6cd
2024-05-17 01:40:57 +03:30
Umherirrender
420e071271 Remove TemplateLinksSchemaMigrationStage config
Bug: T299417
Follow-Up: I906e069a63d1dae14924c72318b22b16244371d6
Change-Id: Ia5f730af82f904bd42552e6c6a5c4dadf2454d3a
2024-05-15 22:27:44 +02:00
Tim Starling
a5372218b7 block: Deprecate and stop using $wgBlockTargetMigrationStage
* Deprecate and stop using $wgBlockTargetMigrationStage. Remove
  block_target migration code.
* Make the $schema parameters to DatabaseBlockStore methods default to
  SCHEMA_BLOCK. Avoid passing these parameters where possible.
* Remove cleanupBlocks.php
* Deprecate DatabaseBlock static methods which try to present the old
  schema for b/c.

Bug: T362133
Change-Id: I845bad8cc09a4528fef46a6f9d490ebdec881d99
2024-05-10 15:54:17 +10:00
Tim Starling
2998d9bd47 block: Migrate to the new block schema on non-WMF wikis
Migrate from ipblocks to block/block_target and drop the ipblocks
table. Update tests.

In PostgresUpdater, change some schema update functions to skip field
updates if the table doesn't exist, by analogy with
DatabaseUpdater::modifyField.

Bug: T346293
Change-Id: Icf91b35f7f729cead7c800429653eb30731762a1
2024-05-09 10:14:43 -04:00
daniel
91a1741787 Introduce Modules into the REST framework
Modules group together endpoints by a shared prefix. The idea is that each module has its own version and can generated self-contained self-documentation. This allows clients to have clear expectations about the endpoints of each module, no matter what wiki they are accessing. So far, each wiki may be exposing a different set of endpoints, with no way to provide a spec that describes that set of endpoints in a way that would be consistent across wikis and stable over time.

Bug: T362480
Change-Id: Iebcde4645d472d27eee5a30adb6eee12cc7d046b
2024-05-08 16:12:30 +02:00
Bartosz Dziewoński
f0c7fa9234 Move section edit links outside headings (new heading HTML)
Legacy parser can now output headings using a more accessible markup,
which is also identical to the markup used by the Parsoid parser.

Changes to client-side JS and CSS necessary to support the new markup
have already been merged in earlier commits.

includes/skins/Skin.php
includes/ServiceWiring.php
* Define a new skin option, 'supportsMwHeading', which can be used
  to toggle the new markup per-skin.
* Update the built-in fallback skin to enable it. This affects the
  output in parser tests.

docs/config-schema.yaml
includes/config-schema.php
includes/config-vars.php
includes/MainConfigNames.php
includes/MainConfigSchema.php
* Add a new configuration setting, 'ParserEnableLegacyHeadingDOM',
  which can be used to toggle the new markup per-site.

includes/OutputTransform/Stages/HandleSectionLinks.php
* Output new heading HTML for skins that enabled the option.

tests/*
* Duplicate parser tests that cover heading generation to cover both
  new and old markup. Update other parser tests to use new markup.
* Add some unit and integration tests for the behavior of the skin
  option and some parser tests for edge cases of the new markup.

Bug: T13555
Change-Id: I1180169a8e83af834c2984ba16089e6277f2a8dd
2024-05-06 12:25:33 -04:00
Alexander Vorwerk
e4127e5864 Move ext-openssl from suggest to require
openssl provides the proper password hashing algorithm, so it is needed
in order to have safe and efficent password hashing.

Change-Id: I61498275c7f7cf19787f0aee50dc4884c57b82b2
2024-05-05 09:42:06 +00:00
Tim Starling
917f0a5996 Replace all instances of "per default" with "by default"
According to the dictionary, "per" (or more conventionally "as per")
means "according to". Refer OED "per" sense II.3.a. For example:

"No value was passed, so return null, as per default".

In this sentence, we are not specifying the default, we are referring
to the default. This correct usage of "per default" was used nowhere
in MediaWiki core as far as I can see.

Instead we have "per default" being used to mean "by default", that is,
giving the value to use when no explicit value was specified.

In OED, the phrase "by default" is blessed with its own section just
for computing usage:

"P.1.e. Computing. As an option or setting adopted automatically by a
computer program whenever an alternative is not specified by the user
or programmer. Cf. sense I.7a."

There are highly similar pre-computing usages of the same phrase,
whereas the phrase "per default" is not mentioned.

As a matter of style, I think "per default" should not be used even
when it is strictly correct, since the common incorrect usage makes it
ambiguous and misleading.

Change-Id: Ibcccc65ead864d082677b472b34ff32ff41c60ae
2024-04-29 10:47:54 +10:00
Amir Sarabadani
cf77897613 Run pagelinks migration for third parties too
Production is read new almost everywhere, mediawiki core should reflect
that as well.

Bug: T299947
Change-Id: I8f05c4d7026394205bfc54b68dc725392852ae2a
2024-04-27 16:57:37 -04:00
Kosta Harlan
6efd008f33 TempAccounts: Rate limit acquisition of temp account names
Why:

- We don't want to allow unlimited acquisition of temp account names.
  These should be rate limited in similar way to how we limit the
  creation of temp accounts

What:

- Provide a TempAccountNameAcquisitionThrottle, and use it in the
  acquireName() method
- Set a default that is 10 times the limit of
  TempAccountNameCreationThrottle

Depends-On: If660aad1d0f04f366414084aff3f88484a19d416
Bug: T343101
Change-Id: I99d5973498a89ac227847de5837c0a8e895c28fb
2024-04-23 13:33:57 +00:00
jenkins-bot
40f4502e9c Merge "Update wgAutoCreateTempUser config defaults" 2024-04-04 09:34:11 +00:00
Dreamy Jazz
102424bfb3 Update wgAutoCreateTempUser config defaults
Why:
* The default value of wgAutoCreateTempUser has not changed since
  the decision to use a different prefix for temporary accounts
  (T332805).
* The default needs to be updated to reduce the number of overrides
  in operations/mediawiki-config and also to make the development
  experience more consistent with what is happening on WMF
  production.

What:
* Update the wgAutoCreateTempUser default in the following ways:
** Set expireAfterDays as 365
** Set notifyBeforeExpirationDays as 10
** Set genPattern and reservedPattern to '~$1'
** Set matchPattern to null, which will mean that the genPattern
   is used as the value.
* Update RealTempUserConfig::getPlaceholderName to add the year to
  the placeholder name so that if the match pattern includes the
  first digit of the year, then the placeholder name still is
  considered a valid temporary account username.
* Replace modifications of the wgAutoCreateTempUser config in
  integration tests with a use of the TempUserTestTrait to make
  the code cleaner and make it easier to find tests that relies on
  the values in wgAutoCreateTempUser.
* Update multiple tests to handle the new defaults for the config.

Bug: T359335
Change-Id: Ifa5a0123cd915bdb7c87e473c51fb93321622f12
2024-04-03 16:25:47 +00:00
Steph Toyofuku
1e26f420dc Add new conditional default conditions for user options: anon and named
Adds two new conditional user option default conditions CUDCOND_ANON and
CUDCOND_NAMED, for the purpose of allowing the specification of a
separate default user option for logged-out users.  We're taking two
different approaches to the targeting of logged-out users (anon vs
named) because of the temporary users project - anon will not include
temporary users while named will allow us to target only fully created
user accounts.  This will be ultimately be used for the rollout of the
reading accessibility settings menu

Bug: T360098
Change-Id: I316d231330159770f05234dd2f5fdb7d07531002
2024-04-02 14:46:53 -07:00
Timo Tijhof
4110f91b22 MainConfigSchema: Consistently mark unstable flags as @unstable
Follows-up 5c78508628, which added ShowLogoutConfirmation (T357484).

Also mark these with appropiate since tags:

* DjvuUseBoxedCommand, T352515.

* UseContentMediaStyles, 8b5f95a963 (1.38.0), T51097.
* UseLegacyMediaStyles, f99dc83677 (1.41.0), T318433.

* EnablePartialActionBlocks, c67f181dd4 (1.37.0) T280531, T280532.

* EnableEditRecovery, 404f3a205d, T341844.

* UseCodexSpecialBlock, 22dc49a5c5, T358153.

Bug: T357484
Change-Id: Ib71902ea46789819069d2351953e308fef3b4c90
2024-03-29 18:07:41 -07:00
jenkins-bot
0ec86c1fb0 Merge "Switch Special:Upload to use async upload-by-url" 2024-03-28 15:22:13 +00:00
Giuseppe Lavagetto
cfa7ed13b1 Switch Special:Upload to use async upload-by-url
With this change, when async uploads are enabled, upload-by-url
will spawn a job and a form with a button to check the status of the
process is shown to the user.

In the process, add processing of warnings in the remote jobs spawned by
the API or the Special page. This is done by adding checks to
UploadJobTrait::verifyUpload. In order to manage warnings serialized in
the job status, a method to unserialize the result of
UploadBase::makeWarningsSerializable.

Things that we might want to fix:
* The form's UI is abysmal, we should probably use Codex
* While it's not a huge deal, I'd like to figure out why I need to
purge the page cache if I want the file to show up. And more
interestingly, why this doesn't happen when uploading via the API

Bug: T295007
Bug: T118887
Change-Id: I49181d93901f064815808380285fc4abae755341
2024-03-28 11:01:46 +01:00
Bartosz Dziewoński
dd992c1a7d Remove $wgHTMLFormAllowTableFormat and its uses
Described as "Evil hack for mobile :(", this config variable had been
overridden in the MobileFrontend extension for some time, but this has
been removed last year in Icb1711a0cef828dda0d99b8a7c7963bc409816c9.

Since it was introduced, most HTMLForms using the 'table' format have
been reworked to use 'ooui' (or 'codex', these days), so the hack is
no longer needed.

We recently removed $wgUseMediaWikiUIEverywhere for similar reasons
in aa7eeeeef9 / be135c0fc0.

Change-Id: Id507c0dc5a1c1cfb9737073bae97b14badc30a54
2024-03-26 22:49:55 +01:00
Giuseppe Lavagetto
c2373af679 Add job for upload from UploadFromUrl
This is the first step to make upload from url work asynchronously

Bug: T295007
Change-Id: I1fb30352849b543c0fb1f27028a34d49dff17797
2024-03-23 11:23:07 +01:00
Derick Alangi
d372626b97
objectcache: Introduce ObjectCacheFactory MW service
ObjectCache is already doing a lot of factory pattern logic like
creating instances of the various BagOStuff, this should really be
the responsibility of the factory servicet.

This patch introduces a proper factory (ObjectCacheFactory) to handle
the responsibility of creating various instances of BagOStuff. Since
`newFromParams()` is a static function that gets passed in configuration
of $wgObjectCaches, that can stay that way (to keep supporting how we do
this in prod today).

Technical Breaking Change: `ObjectCache::makeLocalServerCache()` now has
a parameter and requires it but there are no callers of this method outside
MW core hence it is safe to change (and this patch update all callers) to
work correctly. Cache prefix is gotten from global state because sometimes
at this stage, the services container is not available.

Bug: T358346
Change-Id: I3179a387486377c6a575d173f39f82870c49c321
2024-03-19 12:38:39 +03:00
hmonroy
5c78508628 Add temporary feature flag for logout confirmation
Add a temporary feature flag that is going to be covering the work
around implementing a logout confirmation.

Bug: T357484
Change-Id: I3ee8f52976cb956e24f32115c02903c5c4f358c3
2024-03-15 19:05:47 -07:00
jenkins-bot
5d8b59b3ea Merge "ResourceLoader: Add module property skipStructureTest" 2024-03-13 22:09:01 +00:00
daniel
a9ba533bd7 Config: Mark MainPageIsDomainRoot official
The MainPageIsDomainRoot setting has been supported since 1.34, time to
remove the "experimental" marker.

Note that this setting was never marked as experimental in the documentation: <https://www.mediawiki.org/wiki/Manual:$wgMainPageIsDomainRoot>. It seems likely that it is in use on many third party wikis already.

Change-Id: I02d2b2d4569f505d5dcc59ae60bc9f64deee064c
2024-03-13 15:23:37 +00:00
Tim Starling
c45ca5c0e3 ResourceLoader: Add module property skipStructureTest
Allow extensions with very special modules that can't be called in a
testing environment to skip ResourcesTest::testRespond().

Needed by If1186797fd047d4f for ext.wikisource.OCR.

Change-Id: Id02915d9633c2d8209d2ff2e60f6748095ec10fe
2024-03-11 17:01:16 +00:00
jenkins-bot
3eaeedc5c2 Merge "Add TranslationAliasesDirs to specify special page aliases in JSON" 2024-03-06 16:51:34 +00:00
Kosta Harlan
08fef95627
TempUserCreator: Use separate rate limit for temp account creations
Why:

- The pathway to creating a regular account is different from that of a
  temporary account. It makes sense to rate limiting creation of these
  two types of accounts at different rates.

What:

- Add a TempAccountCreationThrottle config with a restrictive default
  that matches the existing production configuration of
  AccountCreationThrottle (6 creations per day)
- Update resetAuthenticationThrottle.php to support resetting the temp
  account creation throttle
- For now, not adding an equivalent hook for account creation throttle's
  ExemptFromAccountCreationThrottle

Bug: T357777
Change-Id: Ibf36ac96f717107bace6f0a3326f79ed129a1dfe
2024-03-06 14:41:15 +01:00
Abijeet
8ddc4ee2ef Add TranslationAliasesDirs to specify special page aliases in JSON
The TranslationAliasesDirs configuration allows defining translatable
aliases in JSON files. The value should be a name or names of folders
that contains files that have localized aliases. Each language should
have a separate file.

Currently, it supports defining special page aliases but in the
future can be extended to support magic words and namespace aliases.

The patch adds a script: ConvertExtensionsMessagesToTranslationAlias
that can be used to convert existing ExtensionMessagesFiles to the new
format.

Bug: T89947
Change-Id: Ief16a48a8dc8742854f67301791aa2a0b0531116
2024-03-06 18:13:28 +05:30
jenkins-bot
c3b32c0af5 Merge "config: Fix indenting of comment for EditPageFrameOptions" 2024-02-29 19:39:10 +00:00
Reedy
ce1f4d5c55 config: Fix various typos
Change-Id: I0d29beb873d1867a642b787c0e40d2487d1e1691
2024-02-29 18:59:00 +00:00
Reedy
3f1ea15679 config: Fix indenting of comment for EditPageFrameOptions
Change-Id: I1ecdfe47f75195ad8429830e4b5d038aa3452109
2024-02-29 18:42:18 +00:00
hmonroy
22dc49a5c5 Add feature flag for Codex Special:Block UI
Introduce a temporary feature flag that will be used to display
Special:Block UI in Codex.

Bug: T358153
Change-Id: I74bc90af986ac2f429a952a19b6edf4fb02c5618
2024-02-21 13:52:29 -08:00
Tim Starling
380d398f1d Remove $wgUseSameSiteLegacyCookies
After the deployment of the updated mediawiki.cookie module, the
configuration variable can be safely removed.

Bug: T344791
Change-Id: Idf3b3ef521ef2ac368c3f575f99bf4c6da7baa82
2024-02-14 11:26:30 +11:00
jenkins-bot
86965e099d Merge "Drop deprecated config $wgOpenSearchTemplate" 2024-02-13 17:22:42 +00:00
Amir Sarabadani
ef7497d8cd Drop deprecated config $wgOpenSearchTemplate
Not to be confused with $wgOpenSearchTemplates (plural)

Soft-deprecated since 1.25 and hard-deprecated since at least
I9776d11d4e2d184 (1.39).

Not set in production.

Change-Id: I6a95b9e0e2b74bb44d51c375a62886761ec9ea88
2024-02-12 19:54:00 +01:00
Brian Wolff
ea84b992ef Change $wgSVGMetadataCutoff default to 5 MiB (previously 512KiB).
This is used to (among other things) detect lang tags in multilingual
SVGs. Users have complained that lang tags are often missed in large
SVG files.

The cut-off is used for two things during upload:
* Run some (simple) regexes to detect <?xml header
* Use XMLReader (with entity substitution enabled!) to look for specific tags.

The first check doesn't make sense to use a configurable cut off. Change
it to look at the first 4096 bytes only. The <?xml header is required to be
the first thing in the file other than BOM, so this should be more than
sufficient. XML parsers give a fatal error if there is whitespace before
the <?xml declaration.

It seems unlikely to be problematic to use XMLReader on up to 5MB of the file,
since that is a "pull" XML parser, and won't load the entire file at once.
The code that cuts off the SVG at the 5MB mark likely uses more memory
than parsing the file does. In fact, we separately use XMLReader to do
security checks with no such cut-off, so potentially it could even make sense
to remove the cut-off entirely, since clearly parsing the full file is not
causing problems.

Bug: T270889
Change-Id: I7350918647d92c40934a7c86e906b6bfb8a40ada
2024-02-09 19:20:34 -08:00
jenkins-bot
b235bbab53 Merge "Always log a message when disableLocalTransform is hit" 2024-02-09 11:27:31 +00:00
Tim Starling
7c81d82d76
Stop using $wgUseSameSiteLegacyCookies
* Deprecate the wgUseSameSiteLegacyCookies configuration variable and
  imply false (the previous default).
* Deprecate WebRequest::getCrossSiteCookie(), which was introduced to
  support this feature.
* Ignore the sameSiteLegacy option if it is passed to
  WebResponse::setCookie() or mediawiki.cookie.set(). The configuration
  variable can't be removed until the after the JS change is deployed.

Bug: T344791
Change-Id: I30392ebc02809bc6b6ee2070d3e468e48d5d1fae
2024-02-06 16:25:38 -08:00
jenkins-bot
0e593c7a28 Merge "Migrate bot passwords to virtual domains" 2024-02-07 00:11:25 +00:00
Dreamy Jazz
79dd6be086 Remove mention of removal in 1.38 for wgEnablePartialActionBlocks
Why:
* The wgEnablePartialActionBlocks config is marked as unstable,
  but also as to be removed before 1.38.
* This is no longer the case as this config is present in 1.42 and
  as such this should be removed and instead still indicate this
  is unstable without listing a release version for this config.

What:
* Reword the @unstable tag for the wgEnablePartialActionBlocks
  to no longer reference a specific release version.

Bug: T280531
Change-Id: I317cd07c42aa59c6a45bf7403fdc79a363880bb5
2024-02-06 13:41:49 +00:00
jenkins-bot
d9ae1a9609 Merge "grants: Fix risk rating of 'privateinfo'" 2024-02-05 14:29:37 +00:00
Bartosz Dziewoński
be135c0fc0 Remove $wgUseMediaWikiUIEverywhere
MediaWiki UI has never really made it out of beta before being
deprecated. Legacy code using plain HTML forms doesn't need it;
new code can be written using Codex.

Bug: T182050
Change-Id: Ib9966bc6a4a94f771cb99a5aa52fb6a1dc826ca5
2024-02-05 09:05:14 -05:00
Gergő Tisza
b73cce53f7 grants: Fix risk rating of 'privateinfo'
Per T290790#9447932, not actually risky.

Bug: T290790
Change-Id: I99e3f8d7e6cf210954325f2d066cc1475af9bd3a
2024-02-05 13:41:18 +00:00
Amir Sarabadani
be5593b10d Migrate bot passwords to virtual domains
Bug: T351559
Change-Id: I645f1e4a4517b9177286e834236b0c047bef928c
2024-02-01 17:35:29 +01:00
Amir Sarabadani
2d66025fdf Drop deprecated configs $wgMinimalPasswordLength and $wgMaximalPasswordLength
Soft-deprecated since 1.26 and hard-deprecated since at least
I9776d11d4e2d184 (1.39).

Not set in production.

Change-Id: I55e4569c5a40f77a719bc7ab1924eaa706e0da53
2024-02-01 16:29:05 +01:00
jenkins-bot
e4ab75aad5 Merge "rdbms: clarify allowed characters in DBname/DBschema/DBprefix" 2024-01-31 00:25:42 +00:00
Amir Sarabadani
4c68983623 Drop deprecated config $wgAllowImageTag
Soft-deprecated since 1.35 and hard-deprecated since at least
I9776d11d4e2d184 (1.39).

Not set in production.

Change-Id: I68b68ffcdff22daafad34c186d1cc609dcecbf32
2024-01-30 11:42:54 +00:00
Reedy
e2f9bea62b Fix casing of Mediawiki to MediaWiki
Change-Id: I0f266a034a99255b27fd96d82335d6e710a61f20
2024-01-29 17:15:04 +00:00
Amir Sarabadani
c1043ec8ff Drop deprecated config SquidPurgeUseHostHeader
Soft-deprecated since 1.33 and hard-deprecated since at least
I9776d11d4e2d184 (1.39). It's already noop in the code.

Not set in production.

Change-Id: I5895bc4dae9620d53c37188662e21bf01ae7bd85
2024-01-26 16:47:11 +01:00
Amir Sarabadani
ba1563a0ba Drop deprecated config ContentHandlerTextFallback
Soft-deprecated since 1.37 and hard-deprecated since at least
I9776d11d4e2d184 (1.39)

Not set in production.

Change-Id: I0b25e89d1652dfa697ab1176a1e2b6ca3163bdab
2024-01-26 12:45:18 +01:00
jenkins-bot
939fa4e5e5 Merge "Drop deprecated config $wgLogoHD" 2024-01-24 22:40:47 +00:00
Amir Sarabadani
167fbd0a20 Drop deprecated config $wgLogoHD
It has been deprecated since 1.35, hard deprecated since at least I9776d11d4e2d184

No grep result in wmf-config

Change-Id: I2c67bab3e3212f25a0cbce7301f5e32a082f76da
2024-01-24 19:46:04 +01:00
TheresNoTime
2466abb518 EditRecovery: Add user preference
Add a user preference to allow the user to enable or disable
EditRecovery.
Set the default as disabled.

Bug: T350653
Change-Id: Ibbb59eb84f1dd0b40f9576e048f2ac76044f9014
2024-01-23 13:28:31 +00:00
Gergő Tisza
9de0e23b48 Support dependency injection in log formatters
Use ObjectFactory specifications instead of class names in
$wgLogActionHandlers, like in most other places. Class name
support is retained for B/C.

Also remove old LogPage code that assumed $wgLogActionsHandlers
is an array of callables. This is how $wgLogActionsHandlers was
defined in b6d72cfeb2, but then
4ac56c2466 redefined it to an
array of classnames (and I6846ce0 adjusted the documentation),
and the old functionality has been broken since.

Make LogFormatter::__construct() public so subclasses can be
created in the service wiring.

Technically this is a breaking change since there is no
guarantee existing formatter classes are publicly creatable,
but there is no way to issue a deprecation warning about that,
and it isn't really covered by the stable interface policy.
All non-public constructors found by codesearch are fixed in
companion patches.

Bug: T54220
Change-Id: I72427a4b3f4be1c3c1eb3522a8b58fe9445a3397
Depends-On: Ie691e8d59141f696619dce8f756645c45a3e943a
Depends-On: I41562247d51f4f9fe8dafed37ba2ad81c881d99d
2024-01-20 16:36:56 +01:00
Aaron Schulz
448bdf06b1 rdbms: clarify allowed characters in DBname/DBschema/DBprefix
Change-Id: I8e010b27cc436d845687843c2a20dbd89ebe2197
2024-01-18 15:56:35 +00:00
jenkins-bot
e462a9275d Merge "Support multiple matchPatterns in temp user autocreate config" 2024-01-17 17:25:04 +00:00
jenkins-bot
55c5c9ee6f Merge "user preferences: Add some information about types to the phpdoc" 2024-01-17 14:44:10 +00:00
Dreamy Jazz
7f588780a0 Support multiple matchPatterns in temp user autocreate config
Why:
* There is a need to update the generation and match pattern on
  WMF wikis to a new format that includes the year and starts with
  `~`. As such, the 'matchPattern' key needs to be updated.
* Removing the old 'matchPattern' from the wgAutoCreateTempUser
  config currently leaves existing temporary accounts as no longer
  recongnised as temporary accounts.
* Instead, the 'matchPattern' needs to be able to take an array of
  string patterns so that old patterns can still be used for matching.

What:
* Update the MainConfigSchama to indicate that 'matchPattern' in the
  wgAutoCreateTempUser config can be an array of strings.
* Add TempUserConfig::getMatchPatterns and deprecate TempUserConfig::
  getMatchPattern. This is needed because ::getMatchPattern was typed
  to only ever return one Pattern, which is no longer the case with this
  config change.
* Update the RealTempUserConfig to support multiple patterns defined in
  the 'matchPattern' key. The RealTempUserConfig::getMatchPattern method
  returns the pattern or first pattern if multiple are defined to allow
  time for existing usages of this deprecated method to be updated.
* Update the RealTempUserConfig to rely on other methods instead of checking
  object property values where possible (e.g. use ::isEnabled instead of
  checking $this->enabled) to allow easier unit testing.
* Update UserSelectQueryBuilder and ChangesListSpecialPage to use TempUserConfig
  ::getMatchPatterns instead of ::getMatchPattern.
* Update mediawiki.util/util.js to be able to parse the 'matchPattern' value
  when it is an array of strings.
* Update maintenance/userOptions.php to use ::getMatchPatterns instead of
  ::getMatchPattern.
* Add and update unit and integration tests for the new code, as well as
  expanding coverage over existing code that was indirectly affected.

Bug: T354619
Change-Id: I3763daefe4dc7c76370bd934fb20452591c9c762
2024-01-17 11:24:26 +00:00
Gergő Tisza
183372c995 authz: Group grants by riskiness
Bug: T290790
Change-Id: Ib7a195c167f82e686c4ede45388957f9988bf75d
2024-01-16 23:55:48 +01:00
jenkins-bot
5eeb9876c7 Merge "ResourceLoader: Drop targets system, deprecated in 1.41" 2024-01-16 11:11:56 +00:00
Gergő Tisza
044910ae71
user preferences: Add some information about types to the phpdoc
User options saved to the database and retrieved get converted
to strings, but defaults and set but not yet saved vaues don't.
This behavior can be confusing.

When a value equal to the default is set for a given user, that
value won't be written to the database; defaults are represented
by the lack of a database row. This behavior can also be
confusing.

Update the phpdoc of some user preferences related methods and
variables to make these things clearer.

Change-Id: I32a18b30f007c97015e6d641379ce60ab6ac7ed7
2024-01-15 20:25:25 -08:00
James D. Forrester
273cc042ae ResourceLoader: Drop targets system, deprecated in 1.41
Bug: T340802
Depends-On: Ie936afed7042d5a4713b027c30d7487565a35eaf
Change-Id: Icad30d62301be5d7390ebdf34e818519e3fe56c4
2024-01-12 16:42:38 -05:00
Tim Starling
551ec29ea6 Check warnings from INSERT during tests
INSERT IGNORE when inserting NULL into a non-nullable field will succeed
with a warning on MySQL but fail on PostgreSQL. In any case, it's
probably harmful and unintended. But to check the error code of MySQL
warnings, you need to query the server with SHOW WARNINGS, so there is a
performance cost.

So, add a configuration variable which, when enabled, checks warnings
after INSERT to see if there were any null type constraint errors. Set
it to true in DevelopmentSettings.php and TestSetup.php.

Change-Id: I5e47e2d3cc7e0f804036e11b512b1e3b76804432
2024-01-12 09:33:05 +11:00
jenkins-bot
a0a78dbdfb Merge "Tweak docs for UseLegacyMediaStyles" 2024-01-11 16:08:12 +00:00
Timo Tijhof
937847b26a Replace various magic numbers with easy-to-verify expressions
Follows-up I8518e0488 (9c02258a04).

Instead of documenting how to compute the number to manually verify
it, use the expression directly. This should make it significantly
easier to understand, verify, and modify.

Noteworthy:

* Language.php, I kept 31_556_952 as-is because the
  calculation would otherwise involve a float. It also has the benefit
  of allowing the long durations to build upon that as a given number.

* SqlBlobStore.php, remove this irrelevant default value as it is
  unreachable. The only call to new SqlBlobStore is BlobStoreFactory,
  which always calls setCacheExpiry. For back-compat and to keep
  tests as-is, move to re-used constant between class and config.

Change-Id: I86b034883bd7efdf93b8365b43178af826f1c703
2024-01-11 15:12:24 +11:00
Reedy
0efc8a1fdd Tweak docs for UseLegacyMediaStyles
Follows-Up: I70e537b2beb99de9a41e7dc66a0d60a508009887
Change-Id: I96ad111d8972ba55a09ddcd452447c519471a96f
2024-01-10 18:20:58 +00:00
Tim Starling
faf1f74651 Always log a message when disableLocalTransform is hit
* Log a message when thumbnailing is attempted but disableLocalTransform
  is set in configuration. There is already a similar log entry in
  thumb.php but it was missing for other callers.
* Update the config docs.

Change-Id: If4c02b831989e6183b72384e676cddeab1dcf41e
2024-01-10 11:17:11 +11:00
jenkins-bot
7057d995bc Merge "Add support for conditional user defaults" 2024-01-09 04:42:53 +00:00
Martin Urbanec
6c8b696020 Add support for conditional user defaults
Why:
Sometimes, it is necessary to have different behavior
for newly registered and existing users. For example,
this happens in the Echo or GrowthExperiments extensions.
As of now, this behavior is implemented by inserting
user_properties rows in onLocalUserCreated.

Over time, this results in a singificant amount of rows
inserted, which contributes to the user_properties table bloat,
which is already overly large (cf. T54777). This patch makes it
possible to remove such rows by supporting conditional defaults
for user properties.

What:
Add support for conditional defaults of user properties. This can be
configured via `ConditionalUserOptions` config option.

Bug: T321527
Change-Id: I1549c3137e66801c85e03e46427e27da333d68e2
2024-01-09 02:33:17 +00:00
Timo Tijhof
2953becc4d ResourceLoader: Improve docs for $wgResourceLoaderValidateJS
Change-Id: If9591e292910fc2ae7bf2041af57b053d17eb845
2024-01-06 22:33:09 +00:00
Thalia
caf9912323 Use year in temporary user names and restart index each year
Why:

* Part of a temporary user name is generated from an index that
  increments, which is stored in the database.
* As specified in T345855, the index will be restarted each year.
* Also specified in T345855, the year will be included in
  generated temporary user names.

What:
* Since the year must be included in the name in order to avoid
  naming conflicts if the index is restarted each year, both are
  implemented together and controlled by a single config.
* Add a new config option that, when true, restarts the name
  generation index at the start of each year and add the year into
  the user name: $wgAutoCreateTempUser['serialProvider']['useYear']
* Add a uas_year column to the user_autocreate_serial table, which
  is unique in combination with uas_shard, so the index can be
  stored for each shard/year combination.
* The year is added into the username just after the prefix, as
  specified in T345855. This is based on research that having the
  year near the start of the name aids understanding that the
  names are not IP addresses. The position of the year within the
  name is therefore not configurable (though whether to include
  it is). See T345855 for the research.

Bug: T349494
Bug: T349501
Depends-On: I6b3c640a4e74f52fd4a4f46de5a2cbe80fe3b665
Change-Id: If51acb3f4efa361ce36d919c862a52501a5a7d24
2024-01-05 17:14:19 +00:00
Bartosz Dziewoński
6876ccf177 Replace $wgCommandLineMode checks with MW_ENTRY_POINT in other places
I'm not sure if there's a good way to split this up into
logical chunks.

Bug: T313841
Change-Id: I3b35a2e475b5143f383d4085fbc6a0ed3bbc32b8
2024-01-02 22:17:14 +01:00
jenkins-bot
9879c4587a Merge "Fix typo in 'MainStash' docs" 2023-12-23 08:10:05 +00:00
jenkins-bot
3f0e771aef Merge "Temp users: Add 'offset' option for PlainNumericSerialMapping" 2023-12-20 16:32:13 +00:00
Bartosz Dziewoński
05ebaa40a8 Fix typo in 'MainStash' docs
Change-Id: I6d4df851da40f6e44ad3bb5ea6a5679160771da4
2023-12-20 13:11:53 +01:00