Commit graph

59 commits

Author SHA1 Message Date
jenkins-bot
41fe47cde9 Merge "REST: Hide exception message when wgShowExceptionDetails=false" 2022-06-09 21:51:45 +00:00
jenkins-bot
b494330aa7 Merge "ParserCache: always use JSON" 2022-06-07 14:12:29 +00:00
daniel
697f28df32 ParserCache: always use JSON
When JSON support was introduced into ParserCache in 1.36, it was
controlled by a feature flag, $wgParserCacheUseJson. The feature flag
was "born deprecated" in 1.36. It can now be removed.

This means that ParserCache will always store entries as JSON.
Support for reading old non-JSON entries remains intact.
This is needed when updating wikis from a version older than 1.36
to the current version.

Change-Id: Id04e42bfb458d98414bac50e0d6c505e8878e5c0
2022-06-07 15:19:45 +02:00
jenkins-bot
e1ce5bece4 Merge "resourceloader: Decouple some internal constructor args" 2022-06-06 01:05:04 +00:00
daniel
ad11b034ab Settings: Generate schema artefacts using a single maintenance script
Previously, each of the four derived config schema files had to be
regenerated using a separate maintenance script. This change simplifies
regeneration by combining all for scripts into a single command that can
be used to regenerate all relevant files after changing
MainConfigSchema.

Change-Id: I7d38d8a4aede60475c4bdd0053d2e10e298b9843
2022-06-05 19:17:29 +00:00
Timo Tijhof
519e95adc0 resourceloader: Decouple some internal constructor args
Move config defaults to ResourceLoader class, so that the defaults
reside within the component responsibility, and for future standalone
use and unit testing with the same set of defaults.

Bug: T32956
Change-Id: I4a268e11686e526c4377542d45e198a72e57f182
2022-06-02 18:27:33 +01:00
jenkins-bot
ff62deef6c Merge "Allow sharding in site_stats update" 2022-05-31 16:40:33 +00:00
diesel kapasule
e37619873b Remove unused config $wgInterwikiPrefixDisplayTypes
Bug: T306361
Change-Id: Ic6e43d5bbca873dd27e9e2a1f2bc9d0c9a43dfa4
2022-05-31 17:14:20 +02:00
diesel kapasule
8a31497c5f Remove unused configuration global $wgLegacySchemaConversion
I removed $wgLegacySchemaConversion from config-vars and
HistoryBlobCurStub.

Bug: T303684
Change-Id: I7f918ab61ffea377bd827721f9b41ae5d8f82226
2022-05-30 20:59:05 +02:00
Amir Sarabadani
5156ae0404 Allow sharding in site_stats update
This would be useful in cases that lots of edits happen at the same time
and this would reduce the time waiting to get the row lock.

Bug: T306589
Change-Id: I3b869e3b85dfd66575390ef4247f2f81f19c878e
2022-05-30 20:46:08 +02:00
Timo Tijhof
85892edce5 resourceloader: Minor doc changes following PSR-4 namepace change
Follows Id08a220e1d60 (after I92998ae6a82e).

Change-Id: I33d20201bfee4595baa39c01eaf8b7de6034a8ed
2022-05-29 16:41:19 +00:00
jenkins-bot
c60f455dec Merge "installer,rdbms: Remove hints to Oracle and Microsoft SQL Server" 2022-05-28 00:06:42 +00:00
Umherirrender
e3acf723de installer,rdbms: Remove hints to Oracle and Microsoft SQL Server
Fix i18n messages still refers to both rdbms

Bug: T230418
Change-Id: I830c192331786d0dcf58eaf09e34f49fa4c88a06
2022-05-27 23:47:42 +00:00
jenkins-bot
5eff9433f7 Merge "objectcache: Simplify SqlBagOStuff class configuration" 2022-05-27 15:21:44 +00:00
Tim Starling
bcfb90cdd7 objectcache: Simplify SqlBagOStuff class configuration
Substantive changes:

* Remove the parameters globalKeyLB and localKeyLB, not needed in
  production, probably not used anywhere.
* Add a "cluster" parameter, for production.
* Don't call markServerDown() in LoadBalancer mode.

Style changes:

* Document config parameters separately from constructor parameters, to
  clarify the role of the wiring normalisation.
* Inject a load balancer from ObjectCache to SqlBagOStuff, using a
  closure to defer construction.
* Clarify the split between LoadBalancer mode and server array mode by
  introducing a useLB property. Use it instead of special shard index
  values and array counts.
* multiPrimaryModeType wasn't needed anywhere and wasn't available in
  the constructor, so it just became a boolean multiPrimaryMode.
* Add a test covering most of the server array (!useLB) branches.

Bug: T212129
Change-Id: Ib097082efb40b514a29a42286dc362f2e3743ee4
2022-05-27 15:04:43 +00:00
Tim Starling
472d60d249 rdbms: Deprecate DBO_SSL
Using a bitfield breaks server array template merging in LBFactoryMulti.

The only nice thing about flags compared to boolean constructor
parameters is the existence of setFlag(), clearFlag() and
restoreFlags(). But that is not useful for parameters that are used
during connect.

Bug: T134809
Change-Id: I088ef4a0e4c11a2cfe17415b325b455164004c1e
2022-05-27 14:57:31 +00:00
Timo Tijhof
0bb1538929 REST: Hide exception message when wgShowExceptionDetails=false
This reverts parts of I8520d8cb16 and Ib941c22d6b7e.

The documentation of ShowExceptionDetails, as well as all other
uses of it (e.g. MWExeceptionRenderer for index.php, API, and
ResourceLoader) take it to mean to hide both exception message and
details.

This is why MWExceptionHandler didn't have, and didn't need,
the added complexity of this as a parameter as this method
simply wouldn't be called at all in that case.

* Rename the method added in I8520d8cb16 to match the one
  in MWExceptionRenderer.

* Update REST handling to now print any exception details
  when it is true.

* Remove the now-unused code introduced in Ib941c22d6b7e.

Change-Id: I1a9920dea0bafe315a20489efbe46ea9b55b0f74
2022-05-26 14:45:50 +01:00
Tim Starling
3e2653f83b ResourceLoader namespace (attempt 2)
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader itself.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Revert of a241d83e0a.

Bug: T308718
Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
2022-05-24 15:41:46 +00:00
Umherirrender
9d458f6df2 user: Add > to $wgInvalidUsernameCharacters, used by ExternalUserNames
Even when > is in $wgLegalTitleChars it is not allowed in user names

Bug: T308465
Change-Id: Ib9dc055c18837328f4cd858a3ddeb1b6452d9dc1
2022-05-23 22:32:21 +02:00
Amir Sarabadani
24115a8f4c Start clean up of revision_actor_temp table
It is being dropped in production

Bug: T215466
Change-Id: I66b2cb8653252e720c897351065978119f040ba7
2022-05-23 15:37:42 +00:00
mainframe98
0d90560e64 parser: Remove Priority Hints experiment for thumbnails
Both this feature and the web standard are experimental.
The standard was only exposed as a Google Chrome Origin Trial
and the standard has evolved in a non-compatible way.

Bug: T308707
Change-Id: I987c0fb9e3fbb1a9f727b3f171c747246d8adb77
2022-05-19 09:38:17 +02:00
mainframe98
ebffc4f6b1 parser: Remove Element Timing experiment for thumbnails
This feature was experimental, unsupported and untested.
It was disabled by default.

Bug: T308621
Change-Id: I9375f35d031f635af0d39ee0bc027ac719899d9d
2022-05-18 20:34:26 +00:00
daniel
237bbf089f Turn DefaultSettings.php into a deprecated stub
DefaultSettings.php has been replaced by MainConfigSchema.
Loading DefaultSettings.php is deprecated.

Code that needs to have access to configuration defaults should use the
ConfigSchema service object.

Bug: T300129
Change-Id: I7b2c0ca95a78990be1cdb9dd9ace92f6dcf1af15
2022-05-17 16:50:56 +02:00
Tim Starling
a124d003cf TempUser: ScrambleMapping
Add a mapping function which converts sequential integers to a sequence
in which most of the digits change each time, but without significantly
increasing the length.

Change-Id: I1011a96894fbf0b92d20a96149e68014f53e3c3c
2022-05-16 17:36:22 +00:00
Lucas Werkmeister (WMDE)
a241d83e0a Revert "ResourceLoader namespace"
This reverts commit e08ea8ccb9.

Reason for revert: Breaks Phan in extensions, and as far as I’m aware,
this change isn’t urgently needed for anything, so the simplest fix is
to revert it again for now. After PHP 7.4 it should be safer to try this
again (we hopefully won’t need the two “hack” classes by then).

Bug: T308443
Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
2022-05-16 14:43:33 +00:00
Tim Starling
e08ea8ccb9 ResourceLoader namespace
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader and
ResourceLoaderContext.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
2022-05-16 14:41:27 +10:00
Matěj Suchánek
e47c441078 Fix many typos in comments
Found using IntelliJ's "Typo" code inspection.

Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
2022-05-10 12:46:11 +00:00
jenkins-bot
e7573c0e5d Merge "Remove support for $wgMaxRedirect" 2022-05-08 20:25:09 +00:00
Yuki Shira
d73a6a6a6f MainConfigSchema: fix @deprecated tag of $wgSquidPurgeUseHostHeader
$wgSquidPurgeUseHostHeader is @since 1.21 and @deprecated since 1.33.

Follow-Up: I9776d11d4e2d184af35b1117cd7950354c0e343e
Change-Id: Ibaa261fcce3498eba56ab37c8ed95f52e59cfef4
2022-05-06 21:00:29 +09:00
daniel
66f3ab254c Remove support for $wgMaxRedirect
Redirect chains have never worked as intended.

Bug: T296430
Change-Id: If0e514c57b8f3d857d956a581f1b549518ecb099
2022-05-06 10:52:56 +02:00
jenkins-bot
990881f89d Merge "WikiFarm: remove site detection based on domain name." 2022-05-05 15:41:06 +00:00
jenkins-bot
b0fe82514c Merge "MainConfigSchema: Fix typo" 2022-05-05 10:15:20 +00:00
Amir Sarabadani
ceb93545a6 MainConfigSchema: Fix typo
My IDE is complaining.

Change-Id: I2c705dccaccfdc3d4cbb22d9f38fa68d05f63e8f
2022-05-05 10:57:56 +02:00
jenkins-bot
3a8c008ea2 Merge "MainConfigSchema: declare deprecations" 2022-05-04 23:33:17 +00:00
daniel
90ccce647d WikiFarm: remove site detection based on domain name.
While detecting the site name based on the request domain is common,
the exact mappings used in practice differ a lot. If we implemented one,
we could never change it. It seems beter to require the requested site
to be identified explicitly.

Bug: T221535
Change-Id: I31c20e87bb7d5fc4565714e86f547b42bacea82f
2022-05-04 22:09:06 +02:00
jenkins-bot
fc86ffd405 Merge "Call ZipDirectoryReader from MimeAnalyzer" 2022-05-03 23:54:21 +00:00
Tim Starling
910d146679 Call ZipDirectoryReader from MimeAnalyzer
Remove the special case GIFAR vulnerability check from UploadBase. I
put it there because the GIFAR vulnerability was so severe that we
needed to check for it even if $wgVerifyMimeType was false. Now that
support for Java applets has been dropped from browsers, the
vulnerability is not so severe and we can wind back the paranoia.

Add a ZipDirectoryReader invocation to MimeAnalyzer, to replace some
terrible regex hacks. This allows MimeAnalyzer to detect docx files
saved by LibreOffice (T291750).

This is also the new place for the GIFAR check. Add application/java
to $wgMimeTypeExclusions so that JAR uploads are rejected.

Since ZipDirectoryReader cannot look inside the contents of files in the
package, it can't detect the subtype of Open Document files. Use the
file extension instead, like what we do for Microsoft OPC files.

Remove public method detectZipType -- no callers in code search.

Bug: T291750
Change-Id: Iff1611c7adda9c0f0ed31593bad6dfffc9c9a086
2022-05-03 14:43:26 +10:00
daniel
3b7f6ac63c MainConfigSchema: declare deprecations
Declare deprecations as part of the schema, not just in the doc string.
This allows deprecations to carry over to MainConfigNames and
DefaultSettings.php.

Change-Id: I9776d11d4e2d184af35b1117cd7950354c0e343e
2022-05-02 22:15:32 +02:00
Umherirrender
34a7712989 auth: Replace deprecated User::getOption
Bug: T296083
Change-Id: Ia37704771f4fa8222d08d24656ff3c8b437cfa87
2022-04-29 22:50:47 +02:00
Fomafix
b7dff252ca Fix documentation of includes/languages/data/Names.php
The file Names.php was moved from
languages/data/Names.php to
includes/languages/data/Names.php
in e07a279a39.

This change updates the references in documentations.

Change-Id: I95ae3368ec6b7e9a3dfa85257e8d163fde7a47db
2022-04-23 20:12:14 +00:00
jenkins-bot
99836b7c2a Merge "Drop $wgMultiContentRevisionSchemaMigrationStage config" 2022-04-14 19:13:37 +00:00
Tim Starling
e8dbf5f80c TempUser infrastructure and services
Add services and utilities for automatic creation of temporary user
accounts on page save, in order to avoid exposing the user's IP
address.

* Add $wgAutoCreateTempUser, for configuring the system
* Add TempUserConfig service, which interprets the config.
* Add TempUserCreator service, which creates users during page save as
  requested by EditPage. With proxy methods to TempUserConfig for
  convenience.
* Add table user_autocreate_serial. Table creation is necessary before
  the feature is enabled but is not necessary before deployment of this
  commit.

Bug: T300263
Change-Id: Ib14a352490fc42039106523118e8d021844e3dfb
2022-04-14 09:23:55 +10:00
jenkins-bot
e2e5cde968 Merge "debug: Fix $wgDebugRawPage to work with PSR-3 debug logging" 2022-04-13 00:49:05 +00:00
Timo Tijhof
1b218b2b54 debug: Fix $wgDebugRawPage to work with PSR-3 debug logging
The benefit of this setting was largely lost due to wfDebug() having
been replaced with calls to Logger->debug() for much of our code.

This is motivated by making ResourcLoader debug=2 able to make
its concurrent load.php requests more quickly during local dev.

This effectively reverts T49960. I was wrong there, thinking that
this variable has no reason for being. The vast majority of the time,
these aren't of interest on subresource requests. It's trivial
to enable when wanted, and any non-debug level messages still come
through either way, including PHP runtime errors, exceptions,
warnings, etc.

This seems to make load.php about 50% faster for local development
when using mediawiki-docker.
I used `ab` to perform a load.php request 300 times. The mean was
320-360ms before this patch (with and without DebugRawPage=false),
and around 120-140ms with patch (with DebugRawPage=false, default).

Bug: T85805
Bug: T225730
Change-Id: I061419adebf43e83cd0103bdb9b7a3296a2a1122
2022-04-13 00:29:40 +00:00
Alexander Vorwerk
0779a61e15 Drop $wgMultiContentRevisionSchemaMigrationStage config
has no effect since 1.35

Bug: T231674
Change-Id: I69a4463cce42cbd79e1137d748e4a70781999cfb
2022-04-12 21:29:41 +02:00
Alexander Vorwerk
3dd77b0c47 BotPasswordSessionProvider: inject GrantsInfo
MWGrants is deprecated and should be replaced with the GrantsInfo and
the GrantsLocalization services.

Bug: T253077
Change-Id: I3cbf568b6de654acb6b06b4ab5d9d97a09f78ece
2022-04-12 18:48:48 +02:00
jenkins-bot
2425e0099c Merge "filerepo: Enable JSON meta-data serialization by default" 2022-04-11 06:50:06 +00:00
daniel
3bd9096f1e LogActions is a map, not a list.
Bug: T305635
Change-Id: I681b2d7004c0e09184a3256f9d69a7540d68cff8
2022-04-07 18:03:28 +02:00
jenkins-bot
4e96f907df Merge "Make MainConfigSchema more readable." 2022-04-07 11:27:24 +00:00
daniel
123f4d8dfc Make MainConfigSchema more readable.
This allows for PHPDoc-style types to be used in MainConfigSchema,
and adds aliases for the 'object' and 'array' types, to avoid confusion.

The type 'map' can now be used for associative arrays, it will be
represented as 'object' in JSON Schema. Similarly, 'list' can be used to
refer to sequential arrays, it will be represented as 'array' in JSON schema.

In addition, the basic PHP types are mapped to their JSON counterparts,
including support for nullable types. For example:

"?map" will become [ "object", "null" ];
"float|false" will become [ "number", "boolean" ];

Change-Id: I89617d06afd1e97ee1bc9bc49b6c77bed7bd50d9
2022-04-07 12:57:51 +02:00