Commit graph

3674 commits

Author SHA1 Message Date
daniel
0a54ca1526 Remove support for MW_USE_LEGACY_DEFAULT_SETTINGS
The purpose of MW_USE_LEGACY_DEFAULT_SETTINGS was to allow Setup.php to
load default values from DefaultSettings.php, instead of using
MainConfigSchema. It was put into place for the benefit of third-party
installations that encounter issues with using MainConfigSchema. No such
issues have been reported, so we can remove the compatibility switch in
1.40.

The use of DefaultSettings.php as been deprecated since 1.39, but there
are still several extensions that rely on loading it. It remains a stub
for MainConfigSchema::listDefaultValues() for now.

Change-Id: I280f80e5be15fbcd809596087b299add5f83af1f
2023-03-02 13:39:17 +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
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
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
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
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
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
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
daniel
5fcedc88c9 Add wiki-farm support
Added support for an easy to configure multi-tenant ("wiki farm") mode:
Settings for each site can be placed in a directory specified by
$wgWikiFarmSettingsDirectory. Site detection is controlled by
$wgWikiFarmSiteDetector and defaults to the requested host name.

Instructions for manual testing: https://etherpad.wikimedia.org/p/T221535

Bug: T221535
Change-Id: I7581921b7d99ba1fe7e25523fde691d76b67a99c
2022-04-01 14:29:22 +02:00
C. Scott Ananian
2d66ee70a2 Copy over Parsoid's Config and ServiceWiring classes
* This is the first step of migrating Parsoid integration code into
  core and transitioning Parsoid from an extension to a pure library.

* Parsoid already has conditional code to skip loading Parsoid's
  copy of its classes, but it relies on the existence of ParsoidServices.
  Technically ParsoidServices isn't needed once Parsoid is migrated to
  core -- users can just use MediaWikiServices instead -- but we need
  to temporarily add ParsoidServices as a marker class during the
  transition.

This version of Parsoid's ServiceWiring comes from Parsoid commit
898c813fd832b3f2d7b5a37f60bd65e8368ce18f.

Bug: T302118
Change-Id: I0b388d93143a782c2c3b72e46407572e5c586e4a
2022-03-28 12:36:38 -04:00
Taavi Väänänen
caa8a2c3f0
Allow managing upload-by-url allowlist as a system message
This patch introduces a new system message,
MediaWiki:copyupload-allowed-domains, which lets sysops to define which
domains can be used with the upload-by-url tool. This feature is behind
an off-by-default feature flag, which lets system administrators
disable this feature if it is not wanted.

Bug: T300407
Change-Id: Iae7dafbd71182695444210409d550e5b6d10928b
2022-03-23 11:11:41 +02:00
daniel
32e27c7c1c Fix default value for $wgShowEXIF and $wgUSePathInfo.
This was inadvertedly broken in
I7a883fe3c952cc653d43b7e399631ec3beab0bc3.

Change-Id: Ib4b8962fdcea29dd7f37d6a0333088038d4147bf
2022-03-21 21:13:50 +01:00
daniel
1ee8fde16b Generate DefaultSettings.php from schema
Avoid having to maintain defaults twice.

Change-Id: I7a883fe3c952cc653d43b7e399631ec3beab0bc3
2022-03-18 10:25:52 +01:00
jenkins-bot
f747241182 Merge "Remove &$references from $wgAutopromote in DefaultSettings" 2022-03-11 22:33:28 +00:00
daniel
b0cbb9b8ba Remove &$references from $wgAutopromote in DefaultSettings
If we want to convert DefaultSettings to a schema, we can't use variable
references.

Change-Id: Ia53cf45f7f029e1ba4191324005fef25055d5296
2022-03-11 21:38:27 +00:00
daniel
c3b3afa519 Remove conditional initialized from DefaultSettings.php
If we want to turn DefaultSettings into a schema, we can't have
conditionals in there.

$wgCommandLineMode is already initialized in Setup.php, line 136:

  // Set $wgCommandLineMode to false if it wasn't set to true.
  $wgCommandLineMode = $wgCommandLineMode ?: false;

Change-Id: Ib5302bfa36a218611eec6395f90434960bed336c
2022-03-11 10:51:35 +01:00
James D. Forrester
26109fb098 logos: Set default install icon to be an SVG one
Change-Id: I5cd715a0c220667827cde99f0296280110c78631
2022-03-10 12:54:59 -05:00
jenkins-bot
65ba7e2560 Merge "Allow the user to set a default number of search results" 2022-03-09 20:13:45 +00:00
jenkins-bot
e663e2b14e Merge "rcfeed: Deprecate $wgRCEngines and RCFeedEngine" 2022-03-08 21:59:40 +00:00
jenkins-bot
057d3b6358 Merge "Deprecate the ParserOutputHook functionality" 2022-03-08 21:38:43 +00:00
Timo Tijhof
f8ecea1e5c rcfeed: Deprecate $wgRCEngines and RCFeedEngine
Follows-up 39a6e3dc4d (I8be497c623c5d92).

* Improve documentation all around and advertise 'class'
  everywhere instead of 'uri'.

* Add test coverage for RCFeed::factory().

* Deprecate the $wgRCEngines "uri to class" mapping in favour
  of specifying "class" directly in $wgRCFeeds.

* Deprecate RCFeedEngine in favour of FormattedRCFeed.
  Convert to class_alias so that UDPRCFeedEngine no longer has
  to extend the deprecated class name explicitly (for instanceof compat).

* Hard-deprecate RecentChange::getEngine.

Bug: T250628
Depends-On: Ie939e1d06b9ee2d841ec7256c8d24cc4e7e386dd
Change-Id: Ib6758d724c7200404c89c7ab157aa55f1cad9763
2022-03-08 19:50:19 +00:00
jenkins-bot
277453fe78 Merge "Define MW_INSTALL_PATH constant and BaseDirectory config." 2022-03-08 17:44:09 +00:00
jenkins-bot
347275f940 Merge "Add configuration for write both on templatelinks table" 2022-03-08 16:15:57 +00:00
Reedy
396534681b DefaultSettings.php: Add example for $wgSkinMetaTags
Change-Id: I722f112d96f0abb244240e4ba422a8c46d5eb64d
2022-03-08 02:06:43 +00:00
C. Scott Ananian
773801e439 Deprecate the ParserOutputHook functionality
These hooks should be implemented in the OutputPageParserOutput hook
instead.

Bug: T292321
Change-Id: Ib6f457596ea9d193bc03e15a48f135db4f4a6b27
2022-03-07 16:56:10 -05:00
Reedy
11cc2d6993 Consistently use @deprecated since rather @deprecated
Change-Id: I301786f35cd6eb9c63fb72e0b64cffa9efd7b86b
2022-03-06 02:55:54 +00:00
daniel
cf581bb2ca Define MW_INSTALL_PATH constant and BaseDirectory config.
Application logic should use the BaseDirectory config variable.
Framework code should use MW_INSTALL_PATH to locate files should.

NOTE: Update https://www.mediawiki.org/wiki/Manual:$IP

Bug: T300301
Depends-On: I7142af16d692f26e90673b058029f572c1ea3991
Change-Id: Ib4caa80bb7007c4c7960a2fd370cf5da7d9ba344
2022-03-04 14:18:27 +01:00
daniel
f31bc32a65 Remove deprecated alias $wgStyleSheetPath
$wgStyleSheetPath has been a deprecated alias for $wgStylePath since 1.3 (2004).
Time to get rid of it.

Change-Id: I78a6394003b9aefab7aa8559b8e2b22bc50154fc
2022-03-04 13:36:56 +01:00
Amir Sarabadani
f7298b59b8 Add configuration for write both on templatelinks table
Bug: T299419
Change-Id: Ic288ba021eecbed438e9337e52a41c59a89b6a9b
2022-03-03 08:48:13 +01:00
Matthias Mullie
b0bd09c939 Remove change tags for media additions/removals
This reverts commit dab7b16741.

Reason for revert: This was inaccurate/incomplete &
looks like we will not need this after all

Bug: T286362
Change-Id: I6d63d69f180d193f99986ce6878617d63cfb2b6d
2022-02-28 11:08:09 +01:00
Alan Thomas
f003b125ba Allow the user to set a default number of search results
Bug: T215716
Change-Id: I2b355f7830b24f7353a7e7f9e102d5be77b534d6
2022-02-20 22:09:47 +11:00
daniel
0ebf7786b1 DeferredUpdates: Introduce $wgForceDeferredUpdatesPreSend
Enabling this setting will cause post-send deferred updates to be run
before a response is sent to the client, so the client can observe all
effects of their last request immediately.

This resolves a problem with some end-to-end tests that were failing
because the updates caused by one request had not landed in the database
by the time the subsequent request was made.

This patch re-enabled some e2e tests that were disabled because of this
problem. If $wgForceDeferredUpdatesPreSend works as intended, the tests
should again pass reliably.

Bug: T230211
Bug: T301100
Change-Id: I0e30fdb6acba85cec4bb1499f7063ba6bfb0ffb2
2022-02-15 19:49:14 +01:00
Tim Starling
e582572622 Improve ObjectCache integration tests
* Add BagOStuffTest subclasses for all core BagOStuff subclasses,
  replacing PHPUNIT_USE_BAGOSTUFF, as suggested in a todo comment.
* Add config $wgEnableRemoteBagOStuffTests which causes all tests
  enabled by $wgObjectCache to execute, which means that the memcached
  tests are executed by default.

I have verified all except RESTBagOStuff and WinCacheBagOStuff. The
memcached tests fail against memcached 1.5.x but pass against memcached
1.6.x.

Bug: T90875
Change-Id: Id74b5226669f8cb857f859fbc35bc58ab001e873
2022-02-11 10:20:33 +11:00
Tim Starling
b90d2dd5c2 Optimise Skin::getLanguages()
Skin::getLanguages() was consuming 4% of index.php CPU time. In local
testing, it was called three times per page view. So:

* Memoize it, analogous to the nonfunctional code in SkinVector.
* Simplify ClassicInterwikiLookup by removing the option to pass a CDB
  file path. This was only ever supported by a WikimediaMaintenance
  script. In the unlikely event that someone is using this feature, they
  have the same motivation to switch to PHP as we did in T122362.
* Increase the size of ClassicInterwikiLookup's MapCacheLRU from 100 to
  1000. This helps greatly in the case when $wgInterwikiCache is false
  and more than 100 interwikis are requested and seems harmless
  otherwise.
* Optimise Title::getNsText() by assuming that the canonical name of
  NS_MAIN is the empty string.
* Rearrange Message::__construct() to avoid duplicate type checks.

Change-Id: I736cb74efc267fd2473a3267471735238217251c
2022-02-08 22:34:15 +00:00
daniel
f5641f9856 Do not rely on $IP in DefaultSettings.php
In order to allow configuration default to come from JsonSchema,
and dynamic defaults need to be initialized in Setup.php.

This movesd the initialialization of $wgExtensionDirectory and $wgStyleDirectory
to Setup.php

Bug: T294788
Change-Id: I11f5723aa299caa210cf6a1f5b7436f191b1ffc2
2022-02-03 22:05:34 +00:00
jenkins-bot
91e4fc00ca Merge "HttpRequestFactory: allow 0 to mean no max timeout." 2022-01-31 15:31:23 +00:00
Timo Tijhof
1bb26ce403 Metrics: Fix typo in wgMetricsPrefix docs
Follows-up Id022e62e881bdc.

Change-Id: I0c53461dcfc90b53e379b8277c079188b73566af
2022-01-30 03:53:18 +00:00
jenkins-bot
b18023b48f Merge "filerepo: Simplify and document 'favicon' FileRepo option" 2022-01-28 18:14:28 +00:00
daniel
d599a54e5f HttpRequestFactory: allow 0 to mean no max timeout.
$wgHTTPMaxTimeout and $wgHTTPMaxConnectTimeout used to default to INF,
the positive infinity float value. This value has no representation in
JSON. In order to allow default configuration values to be defined in
a JsonSchema, we allow 0 to be used to represent "no limit" instead.

Bug: T294788
Change-Id: Id1b832b46ac6984655dcf0c06d5af7d356cca800
2022-01-28 18:40:03 +01:00