Commit graph

49 commits

Author SHA1 Message Date
Timo Tijhof
adb9c0cc1b poolcounter: Merge Client and ConnectionManager from extension repo
Code moved as-is from the extension repo with minor changes:

* Adopt PSR-4 namespace.
* Keep backward-compatibility with "PoolCounter_Client"
  in LocalSettings, from before the extension was namespaced recently.
* Document how `connect_timeout` actually works, and that it
  was introduced in MW 1.28 (via extension).
* Add stable interface annotations.

Bug: T201223
Change-Id: Iadec5b4b5d2fc7e76509c9be0a8fa605d95c64a7
2022-12-14 20:28:14 +00:00
Kevin Israel
8ae7194fae AutoLoader: Drop support for $wgAutoloadAttemptLowercase
This setting has been deprecated since 1.35.

Bug: T231412
Change-Id: I88cb45a2dcbb19c2976824279bf95a66ae9afd91
2022-12-04 02:38:57 -05:00
Moh'd Khier Abualruz
2dfe4a923b Skins: Config flag controls contributions link
This restores a rewritten version of
commit 78483caaaf.

- Special:Contribute the default entry point in the menu when enabled
- Otherwise it will link to Special:Contributions (default behaviour)

Depends-On: I65336cfd56e1f6b92c1b3bc83cb5d91bbca065bf
Bug: T319327
Change-Id: I67779b88c4904462f9d847b3edb08a65306b2bfb
2022-11-08 10:33:39 +01:00
Timo Tijhof
1cf6f04768 objectcache: Remove WANObjectCacheReaper feature
Introduced in 2017 with I7f14b9ca2533032 (2e5eb693) but remains
unused at WMF, and disabled by default.

Follows-up I62107789fa (9e49260fc9) which added reap to LinkCache
test cases in 2021.

Change-Id: I0654c29a671467dd6b366f462d1c09b90a273413
2022-10-25 23:09:39 +01:00
Amir Sarabadani
9086e418ef Externallinks: Add ability to write to the new fields
This only supports WRITE_BOTH for now, the rest will be implemented.

Tested locally, works fine.

Bug: T318606
Change-Id: I6f898aa89f7d36f3f8a4eb8c23706c64a90896b0
2022-10-25 22:14:15 +02:00
daniel
bb10b7d528 Settings: add support for obsolete config
This allows config variables to be declared obsolete. Obsolete config
will be omitted from the schema, defaults, name constants, etc. The
purpose of keeping a declaration of obsolete config around is to allow
the updater to warn admins that they are using a config variable that no
longer has any effect, and provide them with a remedy.

The idea is that support for deprecated config can be removed after one
release per the stable interface policy, but the declaration of
obsolete config should be kept for as long as we support updates,
that is, at least two LTS releases.

See https://www.mediawiki.org/wiki/Topic:X4bh4nf3pe2ho5jj for
discussion.

Change-Id: Ia7a00742ea7a5311e820a6a43b11135a3f2a825f
2022-10-14 15:00:43 +02:00
C. Scott Ananian
4cb3957cf0 Remove $wgParserTestFiles, deprecated in MW 1.30
This global variable was replaced by auto-discovery of parser test
files in extensions and is no longer needed (or used).

Change-Id: Ib616e60f36db32ffd8bc69c71a096f23c0a27910
2022-10-13 09:22:22 -04:00
Reedy
e6308c4e52 chmod 644 some files that are 755
Change-Id: I7e4d3ebe47c2dd43e822897cf87a75028d740703
Follows-Up: I2a679b51758020d3e822da01a1bde1ae632b0b0a
2022-10-08 01:39:44 +01:00
Derick Alangi
0ec96651f7 ServiceWiring: Remove backcompat code and kill $wgShellboxUrl
https://codesearch.wmcloud.org/search/?q=ShellboxUrl&i=nope&files=&excludeFiles=&repos=
shows that this is indeed not used and should have been removed by
1.38

Change-Id: I23cc10e4838050e20c24922145e551f3c070ff2f
2022-10-05 11:45:54 +00:00
Moh'd Khier Abualruz
6d6c8db99c The Special:Contributions page should show tabs to Special:Contribute
Follow up to
- I7f064a954a77373dfec86efae7e378402f500198
- Iac34777a89e3e6732a0916dbf0a22677cbc6d121

Bug: T319240
Change-Id: I90f943744d2ca0d384a3b378dce473b9f1edafb6
2022-10-04 23:04:49 +00:00
Matthias Mullie
c4a36b0023 Introduce SearchResultThumbnailProvider & move hook + NS_FILE thumbs in
What was previously a REST API-only feature (the thumbnails
hook allowing for thumbnails for non-file pages via the
PageImages extension) is now also being adopted in the main
search page.

That hook will now be called with NS_FILE result thumbnails
pre-filled, which was not the case previously. PageImages
essentially duplicated NS_FILE thumbnail logic that was
already present in Special:Search, so that can (and will
in a follow-up patch) then be removed there. Special:Search
will then simply take whatever is produced from the provider
(which will include both NS_FILE thumbs - which it handled
already - as well as whatever else it receives from the hook),
as will the REST API (which already received both)

Since thumbnails can now come in for multiple namespaces &
having some of those results with & others without a thumbnail
can be quite jarring, it was decided that we'd display
placeholder images (for certain namespaces). This is now
controlled by $wgThumbnailNamespaces.

I also split up a few things in FullSearchResultWidget::
generateFileHtml for more clarity.

Meanwhile also updated mediawiki.special.search.styles.less
to use variables for known colors.

Also implemented a 'transform' (required for testing this
change properly) and 'getDisplayWidthHeight' (it became
needed after implementing transform) callback function for
mock Files, and updated some existing tests in response to
these changes.

And some more Rest test files have been updated to allow
passing around a HookContainer instead of only an array of
hooks (from which a new HookContainer would then be created)
to allow the same container to be used across all relevant
objects, who may have it injected as dependency.

Bug: T306883
Change-Id: I2a679b51758020d3e822da01a1bde1ae632b0b0a
2022-10-03 10:52:50 +00:00
Jsn.sherman
acb989af2d Revert "Mobile Preferences - display Special:Preferences as a vertical menu"
This reverts commit cfed8e7743.

Reason for revert: Will implement a hook rather than changing config at runtime

Change-Id: I5a941b871f9a6347744e800ea63cd82450ab6da3
2022-09-15 21:37:45 +00:00
suecarmol
cfed8e7743 Mobile Preferences - display Special:Preferences as a vertical menu
This patch changes the Special:Preferences menu layout to display as a vertical menu. This function will only work for users with AMC enabled.

It also creates a variable (SpecialPreferencesUseMobileLayout) that changes when a user navigates to Special:Preferences on mobile and has AMC enabled.

Bug: T311717
Change-Id: Ia7a730cd7f009dbb921a810f27fae4a9ee66f793
2022-09-15 13:07:50 -05:00
Timo Tijhof
0ff333e2ff ResourceLoader: Remove $wgIncludeLegacyJavaScript and simplify code
When the deprecation of wikibits.js originally started, it contained
a ton of things [1] such as:

* user-agent utils, `clientPC` and `is_gecko`.
* addOnloadHook.
* importScript.
* appendCSS.
* stylepath and other config vars.
* tooltip, e.g. updateTooltipAccessKeys.
* portlet, addPortletLink.
* tablesorter, e.g. ts_makeSortable, ts_getInnerText
* searchsuggest.
* notify utils, e.g. jsMsg.
* spinner utils, e.g. injectSpinner.
* event utils, e.g. hookEvent.
* siblings scripts included: mwsuggest, sajax.

Except for two (addOnloadHook, and importScript), these have all found
new homes and been succesfully migrated and replaced over the years
with other platform APIs.

The $wgIncludeLegacyJavaScript variable hasn't been needed for a while
as what it gated no longer exits. Remove it and fold the two remaining
functions into mediawiki.base as defacto stable APIs.

* addOnloadHook: Not worth breaking imho. I've shortened the
  implementation which saves a few bytes in WMF prod, and adds a few
  bytes for CI/third-party where it was previously absent for new
  wikis (thus reducing portability).

* importScript: Never deprecated in the first place as there is no
  mw.loader equivalent to this. In order to achieve optimal cache
  performance, and benefit from automatic purging after edits, one
  must craft a very specificly encoded and ordered canonical
  action=raw URL. This is not something end-users need to know about,
  and is what imporScript exists for to abstract. Plus, it ensures
  de-duplication. One day something like Gadgets 3.0 (T36958) might
  take off, but for many years to come, importScript remains the best
  and only supported and usable means within the platform to share
  and load user scripts.

Tested with: `curl 'http://localhost:8080/w/load.php?modules=mediawiki.String%2Cbase%2Cuser%2Cutil&skin=vector' | gzip -9 | wc -c`.

Before: 9.53KB
After: 9.45KB

[1] https://gerrit.wikimedia.org/g/mediawiki/core/+/1.17.0/skins/common/wikibits.js
[2] https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)

Change-Id: I10f17f68fea862d510d188b927f4a7b38be0e4a4
2022-09-11 16:52:07 +02:00
Ori Livneh
a87177564a Support CDN query parameter re-ordering
MediaWiki sets a large 'Cache-Control: s-maxage=' directive on page
views only if the request URL matches one of the normal CDN URL forms.
When MediaWiki is behind a CDN that re-orders query parameters on
request URLs, we want the CDN URL matching logic to be insensitive to
the order of query parameters. This change introduces a
'CdnMatchParameterOrder' configuration option that can be used to
control this behavior. It defaults to 'true', which preserves the
existing behavior (order-dependent matching).

Bug: T138093
Change-Id: I3c52ca47e095ba32511892853dac6c87a1cc2321
2022-08-09 01:53:38 +00:00
lokal-profil
a4520fdc3d Update docstring per introduction of maintenance/generateConfigSchema.php
Bug: T314556
Change-Id: I004d8f693bb2bb10c198feddbbc1d1b50999ac73
2022-08-04 09:42:47 +02:00
Timo Tijhof
3e682f7280 Skin: Remove schema leftover for removed $wgFooterLinkCacheExpiry
Follows-up 1fa903a211 (I581c49839ab4).

Bug: T313462
Change-Id: Id2c7043fb89d59026dacefbdf1599e6cbf9ef418
2022-08-02 01:48:38 -07:00
Tim Starling
51ddd70682 Remove Flash cross-domain policy mangling
Remove Flash cross-domain policy mangling. Users who are somehow still
using Flash as a browser extension will be exposed to CSRF
vulnerabilities.

Deprecate the config since deprecation has some advantages in the new
config system over simple removal.

Bug: T279496
Change-Id: I2c0e85a430d7e6aaf8d5decd00cf1dade04cebe1
2022-07-22 11:44:49 +10:00
daniel
e8cc4c8f91 Fix type declarations in MainConfigSchema
Validating against the live schema on the WMF cluster exposed several
issues with the config schema. Mostly settings declared to be lists
which are actually associative arrays.

This also removes deprecation markers for some settings that are still
in active use, just discouraged or unstable.

Change-Id: I63e816edd1a561bda6063f8558ccce88c113df3f
2022-07-15 16:11:50 +02:00
daniel
cf39a40f16 SettingsBuilder: report warnings
This adds functionality to SettingsBuilder for collecting warnings to be
logged later, when the logging mechanism has been set up.

This also adds a validation step to update.php that aborts the update
if any warnings have been registered in SettingsBuilder, or the settings
fail to validate against the settings schema.

Change-Id: I387905289fb93591f79b96bf4c6cb5ec692b2aff
2022-07-15 12:24:20 +02:00
Tim Starling
bcbfc9ccfc Introduce new WRStats library for write-read stats
A library for storage of counter value time series statistics, based
around the observation that memcached getMulti() is apparently fast
enough to do this in a simple manner, with incremented values stored
in time window buckets.

Bug: T310662
Change-Id: I26b1cdba0a06ad16ad8bb71b455e1b6180924d17
2022-07-05 10:35:19 +10:00
daniel
4dd7bd16b5 ParsoidOutputStash: make storage backend configurable.
This introduces the ParsoidOutputStash config setting, which defines the
storage backend and cache duration. The storage backend name refers to
an entry in the ObjectCache setting, and defaults to the main stash.

Bug: T267990
Bug: T309016
Change-Id: Ic67dc43ed9843810e4b180127f9a3bb7608f7608
2022-06-14 14:11:37 +01: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
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
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
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
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
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
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
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
6880561a4d Generate config name constants.
We can generate a class that contains constants for all config variable
names. This removes the need to rely on string literals when calling
Config::get, and it provides a place for documentation that integrates
better with IDEs than the markdown file.

Change-Id: I817dc14c4ce8fc0a29d9c07e8fd393c4f359cade
2022-03-18 10:32:58 +01:00