Commit graph

185 commits

Author SHA1 Message Date
Derk-Jan Hartman
01b38b3f30 wgSVGNativeRendering default should be false, not 'false'
Follow-up to I9647fdd72f868c821eb20f67b239826f23655a1c

Bug: T208578
Change-Id: I648521ed044ebd5aa68e5420d73d3c07ca87986f
2023-05-27 10:37:57 +03:00
Simone Cuomo
373a9fb691
Special:Search - Update interwiki sister icons
- [x] Add Wikimedia Icons to project
- [x] Fetch Interwiki icons if they exist
- [x] Fallback to previous functionality for icons not available in OOUI
- [x] Create config to override icons

Bug: T315269
Change-Id: I5d904e467a978847bbc9af65fdba1ef729068993
2023-05-25 09:21:02 -04:00
jenkins-bot
f0157644f6 Merge "Add option to allow SVGs to be rendered clientside" 2023-05-24 12:08:36 +00:00
Derk-Jan Hartman
85dd5826c4 Add option to allow SVGs to be rendered clientside
Add wgSVGNativeRendering to allow clientside rendering of SVG files

Default is false. When enabled with true, will serve ALL SVG files
as is to the browser.
When set to the string 'partial' it will conditionally serve SVG
files based on criteria. Currently it will force PNG rasterization
for translated SVGs and for SVGs over wgSVGNativeRenderingSizeLimit

wgSVGNativeRenderingSizeLimit is a byte size limit to avoid larger
SVG files (potentially much bigger than a PNG) from being served
directly to browser.

Native SVG rendering does not provide PNG fallback. SVG support in
browsers has evolved far enough that this should rarely be a problem.

Bug: T208578
Change-Id: I9647fdd72f868c821eb20f67b239826f23655a1c
2023-05-23 09:33:18 +00:00
Amir Sarabadani
5e453406e5 Change the default skin from Vector to Vector-2022
Bug: T301527
Change-Id: I2ce293be5622f471dd140334a15b3a85abef51c1
2023-05-20 16:58:10 +02:00
Lucas Werkmeister
608da7026d Add Authorization to default $wgAllowedCorsHeaders
This is necessary for client-side OAuth 2.0 applications.

Bug: T322944
Change-Id: Ifae42f2dd6c5139b26e2fa3c96fef9505603859e
2023-05-12 19:13:10 +02:00
jenkins-bot
c349002235 Merge "ResourceLoader: Allow FileModule scripts to be generated with a callback" 2023-05-10 02:19:38 +00:00
Umherirrender
e8bf1a18db title: Remove protection related deprecated Title functions
- Title::areCascadeProtectionSourcesLoaded()
- Title::areRestrictionsCascading()
- Title::areRestrictionsLoaded()
- Title::getAllRestrictions()
- Title::getCascadeProtectionSources()
- Title::getFilteredRestrictionTypes()
- Title::getRestrictionExpiry()
- Title::getRestrictionTypes()
- Title::getRestrictions()
- Title::isCascadeProtected()
- Title::isProtected()
- Title::isSemiProtected()
- Title::loadRestrictionsFromRows()

Bug: T306131
Change-Id: Id6c3a648453db51c464faeef2ecac4ffaa0676c1
2023-05-10 00:04:20 +02:00
Tim Starling
a59c446154 ResourceLoader: Allow FileModule scripts to be generated with a callback
To implement source maps, we want FileModule::getScript() to return
an array with path information, but that would break subclasses of
FileModule which concatenate to the return value of parent::getScript().
So allow scripts to be generated by a callback, eliminating the need for
concatenation in subclasses.

* Factor out most of the loop body of expandPackageFiles() into
  expandFileInfo(). Add 'name' to the return value. Ensure 'filePath'
  is always a FilePath object since we need that to safely return it
  to ResourceLoader later. Document the return value.
* Make sure the base path is always set in FilePath objects returned by
  expandFileInfo().
* Factor out the loop body of the final stage of file info expansion
  into readFileInfo(). Retain filePath, do not unset it.
* Assert that $fileInfo['content'] is definitely set.
* Convert array_map() in getDefinitionSummary() to a loop.
* Migrate LanguageDataModule.

Bug: T47514
Change-Id: I97d61b5793159cea365740e0563f7b733e0f16de
2023-05-09 11:47:40 +10:00
Amir Sarabadani
c05c261491 auth: Use IConnectionProvider instead of LoadBalancer
Bug: T330641
Change-Id: Ia0722050b66f1d4919dc5f99da0c77cc98f35d92
2023-05-03 13:23:43 +02:00
Thalia
8bfd88c61d Fix typo in MainConfigSchema comment
Change-Id: Ib8f83cdc69eec4aebdc85fab9926ba01abeacc20
2023-05-03 03:23:55 +00:00
James D. Forrester
6c7177349b ResourceLoader: Raise MW JavaScript startup requirement to ES6
The UA sniffs that overrode the feature tests are no longer needed.

* MSIE 10: Fine, rejected by feature checks.

* UC Mini "Speed Mode": Redundant, the version that this sniff
  matched is pre-ES6. Current versions of UC Mini don't appear to
  support enabling "Speed Mode" on random websites nor does it offer
  it for Wikipedia specifically.
  Details at https://phabricator.wikimedia.org/T178356#8740573.

* Google Web Light: Redundant, shutdown as of 2022.
  Any references or extensions that still reach the proxy, get
  redirected to our online URLs
  https://googleweblight.com/?lite_url=https://en.m.wikipedia.org/wiki/Banana
  https://phabricator.wikimedia.org/T152602
  https://en.wikipedia.org/wiki/Google_Web_Light

* MeeGo: Redundant, discontinued and presumed rejected.
  Either way, unsupported.

* Opera Mini: Fine, rejected by checks.
  Details at https://phabricator.wikimedia.org/T178356#8740573.

* Ovi Browser: Redundant, discontinued and presumed rejected.
  Either way, unsupported.

* Google Glass: Improve UX (since 2013, T58008).

* NetFront: Redundant. Old versions are presumed rejected.
  Current versions are Chromium-based and presumed fine.
  The exclusion was not UX based, but due to jQuery explicitly not
  supporting it in 2013. This is no longer the case, so we can let
  the feature test lead the way here.

* PlayStation: Redundant, same story as NetFront.
  The version that matched the sniff is presumed rejected.
  Current versions probably fine, but even not, don't match
  our sniff so are already enabled today.

Bug: T178356
Change-Id: Ib6263ce3ffd11af5e501de8857f3e48a248c6210
2023-03-30 14:26:05 +01:00
C. Scott Ananian
cfd9c516e1 Allow setting a ParserOption to generate Parsoid HTML
This is an initial quick-and-dirty implementation.  The
ParsoidParser class will eventually inherit from \Parser,
but this is an initial placeholder to unblock other Parsoid
read views work.

Currently Parsoid does not fully implement all the ParserOutput
metadata set by the legacy parser, but we're working on it.

This patch also addresses T300325 by ensuring the the Page HTML
APIs use ParserOutput::getRawText(), which will return the entire
Parsoid HTML document without post-processing.  This is what
the Parsoid team refers to as "edit mode" HTML. The
ParserOutput::getText() method returns only the <body> contents
of the HTML, and applies several transformations, including
inserting Table of Contents and style deduplication; this is
the "read views" flavor of the Parsoid HTML.

We need to be careful of the interaction of the `useParsoid` flag with
the ParserCacheMetadata.  Effectively `useParsoid` should *always* be
marked as "used" or else the ParserCache will assume its value doesn't
matter and will serve legacy content for parsoid requests and
vice-versa.  T330677 is a follow up to address this more thoroughly by
splitting the parser cache in ParserOutputAccess; the stop gap in this
patch is fragile and, because it doesn't fork the ParserCacheMetadata
cache, may corrupt the ParserCacheMetadata in the case when Parsoid
and the legacy parser consult different sets of options to render a
page.

Bug: T300191
Bug: T330677
Bug: T300325
Change-Id: Ica09a4284c00d7917f8b6249e946232b2fb38011
2023-03-26 21:46:05 -04:00
jenkins-bot
43c842074e Merge "Allow a temp username pattern to be reserved without activating the system" 2023-03-23 02:26:51 +00:00
Arlo Breault
892781fe94 Change the default of wgParserEnableLegacyMediaDOM to false
The 7% increase in css shipped is because of styles added for the
content-media feature, without dropping content-thumbnail.  This is
noted in T297984#8525146

Getting rid of content-thumbnail won't be possible until templates and
extensions that mimic the parser output have been migrated, which is
being worked on in T318433.

Bug: T314318
Bug: T297984
Bug: T318433
Depends-On: Ib54b49d546423dd1b4416c82585bbb686950b29c
Change-Id: Ic587b1b9b8d22f3aef38e8823613815faaa09d9d
2023-03-17 12:09:29 -04:00
Tim Starling
b39f13975c Allow a temp username pattern to be reserved without activating the system
Split concepts of "match pattern" and "reserved pattern". Add config
"reservedPattern" which specifies a username pattern to be denied for
creation, but unlike matchPattern, it does not immediately flag all
accounts with such names as temp accounts. This can be used before
migration or after rollback to safely prevent creation of conflicting
accounts.

* Add TempUserConfig::isTempName(), which does what isReservedName()
  previously did, i.e. determines if a name is a temp username.
* Make TempUserConfig::isReservedName() return true if the name matches
  either the match pattern or the reserved pattern.
* UserNameUtils::isTemp() continues to determine whether a username is
  actually a temp username.
* Add UserNameUtils::isTempReserved() as a proxy for
  TempUserConfig::isReservedName()

Bug: T307064
Change-Id: I26755731fad89530a06824181106cd7b4e077d9e
2023-03-15 09:02:20 +11:00
Tim Starling
9e534bd0d8 Renameuser: tweaks and followups
* Use IConnectionProvider
* Inject services into the job
* Use JobSpecification to avoid unnecessary service construction

Bug: T27482
Change-Id: I75ac8c53b874742a3a54526692767d0f549e5259
2023-03-13 09:20:53 +11:00
jenkins-bot
39e2001335 Merge "objectcache: Remove $wgMainWANCache and $wgWANObjectCaches" 2023-03-07 23:07:49 +00:00
Timo Tijhof
39ead04e98 objectcache: Remove $wgMainWANCache and $wgWANObjectCaches
We always wrap the local cluster cache, and there are no subclasses
of WANObjectCache. It was never documented or recommended how these
would be used. It is a left-over from the original 2015 Multi-DC plan
in which WANObjectCache would work differently. See task for details.

Note that this requires no configuration changes, even in the
theoretical case of these variables being used, as the only
option is to use the main cache, and that's also the default.

* Update WAN overrides to override the underlying main cache
  instead.
* Fix EditPageTest which was previously implicitly using a 'hash'
  as main cache but also relying on wan cache to be 'none'.
  The part that it actually needs is the 'none'. When WAN cache is
  enabled, testUpdateNoMinor fails due to an edit conflict because
  one of the edits it makes is made with a current timestamp whereas
  it expects to simulate wpEdittime in the year 2012 which, when
  caching is enabled, is ignored and becomes the current time instead.
  I don't understand exactly why, but I'm going to conserve that
  behaviour for now.
* Fix TemplateCategoriesTest, which was failing due to an unexpected
  cache hit:
  > [objectcache] fetchOrRegenerate(…:page:10:…): volatile hit
  This could be solved in a more realistic way by splitting the test,
  or by explicitly resetting services half-way the test to clear
  WikiPageFactory, PageStore and WANCache process state.
  For now, keep the prior behaviour of no cache in this test.

Bug: T305093
Bug: T329680
Depends-On: If890622eed0d0f8b4bd73d36ba1815a3d760ea05
Depends-On: Ie1def75208822bdf19bb2cfd7e6edf32c2000e6b
Depends-On: I35cce61dc3ee90dcee3dd6f0b36f84133be029ed
Change-Id: I53781a8c06ebb2583f6ca83dd91bbfe8a5c88b13
2023-03-07 22:47:04 +00:00
Derk-Jan Hartman
005d20e470 Remove IEContentAnalyzer
This supported mostly IE 6 and 7 as well as some very old Safari
versions against sniffing. Browsers later implemented
X-Content-Type-Options: nosniff which should protect against this
problem.

Bug: T309787
Change-Id: Iea61bd82033551008eb1832fe899ea28ccb23385
2023-03-07 02:27:45 +00:00
Tim Starling
7efc7f7518 Copy the Renameuser extension into core
Copy the Renameuser extension into core, with minimal code changes. The
hook handlers are inlined into Article, SpecialLog and
SpecialContributions.

Bug: T27482
Change-Id: I314021f4138773df6aaf2753b33ab8283cd16974
2023-03-03 09:39:39 -05:00
jenkins-bot
d236f24059 Merge "Rename rate limits to match permission names" 2023-02-26 23:53:59 +00:00
daniel
d4f785d931 Rename rate limits to match permission names
This changes the name of the rate limits to match the name of the
corresponding permission:

1) "emailuser" is now "sendemail".
2) "changetag" is now "changetags".

This is done in preparation for merging rate limit checks into Authority.

Backwards compatibility is retained, but the old keys trigger a settings
warning which will be shown by the updater.

Bug: T310476
Change-Id: I59163c88a3f9237ee4592f4b51e3f56359f73fc0
2023-02-26 13:21:40 +01:00
Cole White
fa92ab43e9 Metrics: rename Metrics lib to Stats
Bug: T240685
Change-Id: Ie43d894b6b4030a88e397495d40886ccb6e69835
2023-02-24 23:01:32 +00:00
jenkins-bot
3354336bf1 Merge "Hard-deprecate Language::getLocalisationCache/getMessagesFor" 2023-02-22 22:01:53 +00:00
jenkins-bot
677b99a24f Merge "Update $wgJobRunRate comments to mention buffers and fastcgi" 2023-02-21 02:06:23 +00:00
Umherirrender
965d7ed49a specials: Create Special:MyLog to link to logs performed by me
Special:Log allows to have the type, the user or type + user as subpage,
link to this page to show logs from me.

- Special:MyLog redirects to Special:Log/<me>
- Special:MyLog/create redirects to Special:Log/create/<me>

This does not show logs against me (like blocks)

Bug: T327565
Change-Id: Id624cb84d8bbac87d2f820c7c283d4c13866bff5
2023-02-16 21:17:17 +00:00
Aaron Schulz
390c289940 Update $wgJobRunRate comments to mention buffers and fastcgi
Change-Id: Iab0c8c842492abe540260cfbc8178b007bd04c85
2023-02-15 01:10:40 -08:00
Timo Tijhof
841cf29cd7 rdbms: Update old LBFactoryConf docs and remove needless file path
Follows-up If5476e69dd6d6. There is no need to provide the current
path to this class as this not only easy to look up, but in most text
editors it is faster to open the file without a path than with,
e.g. by clicking on the class name in IDEs, or in simpler editors
by simply copying the word "LBFactoryMulti" and using quick open to
view the first matching file with that in its name.

We don't do this elsewhere either, and actually adds confusion on
doc.wikimedia.org where it's not clear how to folllow the instruction.

Change-Id: Iade0dafe2ad0e924d5c8a9fda76065bc806517c5
2023-02-10 23:29:01 +00:00
Reedy
decc3fd7f5 Improve some documentation around DisableQueryPageUpdate
Change-Id: I384f4af5294b6adbbf95e0f97e475b733b878d26
2023-02-09 20:25:26 +00:00
C. Scott Ananian
310d335136 Improve ApiQuerySiteInfo handling of deprecated and "extra" language links
Fix documentation related to ExtraInterlanguageLinkPrefixes
configuration: it should be a list, not a map, and described usage
better.

In ApiQuerySiteInfo, third-party clients (like Parsoid) need to know
whether a given language link core corresponds to a deprecated
language code or a "real" one; the API was also missing information
regarding which language code an "extra language link" prefix
corresponds to (given by InterlanguageLinkCodeMap in the
configuration).

Finally, add the corresponding bcp47 codes for these interlanguage
links, so third-party clients don't need to know details of mediawiki
internal and deprecated language codes.

Change-Id: I82465261bc66f0b0cd30d361c299f08066494762
2023-02-09 16:27:24 +00:00
Umherirrender
b1cfd103a5 rdbms: Fix path to LBFactoryMulti.php in LBFactoryConf documentation
Change-Id: If5476e69dd6d63cd91f1f9b26cb8fcfc4eb08072
2023-02-08 22:18:35 +00:00
Umherirrender
5258a0663e Hard-deprecate Language::getLocalisationCache/getMessagesFor
Also Language::getMessageFor and Language::getMessageKeysFor

Bug: T325981
Change-Id: If75248ebd0591164bd5a26b3e9acdfe1a9191b56
2023-02-01 20:39:15 +01:00
Timo Tijhof
24509f97c0 ParserCache: Improve docs for cache type and purgeParserCache.php
Change-Id: I3301ff90a135bd0103c1dfc7e86f1dd1ba245a5a
2023-01-30 20:49:52 +00:00
Timo Tijhof
190598d10f ResourceLoader: Follow-up to adding ResourceLoaderClientPreferences
Minor clean up:
* Fix broken `@see` in MainConfigSchema.
* Add missing `@since`.
* Doc experimental nature, as per the Ic3b6eec1995393 msg.
* Doc anonymous scope, and mention general strategy for elsewhere.

* Dependency inject, to separate concerns and keep ClientHtml
  decoupled from MediaWiki settings like wgCookiePrefix, which
  otherwise break testing this class with only RL-specific config.

* Apply JS conventions. Made easier by using "JS" as the heredoc
  identifier, which IDEs recognise as for highlighting.

* Move code together with the other documentElement.className
  statement. This helps both with understanding the PHP side in terms
  of related logic and how it interacts, as well as the frontend as
  it literally brings <html script>, client-js, and clientpref all
  next to each other.

HTML weight of default Main_Page on localhost, logged-out:

* vector                              : 23.21 kB / 140.48 kB
* vector-2022                         : 24.17 kB / 146.43 kB +6.0 kB
* vector-2022 ClientPref=true before  : 24.28 kB / 146.70 kB +6.3 kB
* vector-2022 ClientPref=true after   : 24.27 kB / 146.68 kB +6.2 kB

Given:
* $wgResourceLoaderClientPreferences = true;

Test plan:
1. View /wiki/Main_Page?useskin=vector-2022 while logged-out,
   confirm the inline script is there, and
   "vector-feature-limited-width-content" is set on <html class>,
   layout width appears fixed.
2. Run mw.cookie.set('mwclientprefs', 'vector-feature-limited-width-content');
3. Refresh and confirm the class is changed at runtime and layout
   width is fluid.

Use mw.cookie.set('mwclientprefs', null) to undo.

Bug: T321498
Change-Id: I07f471b815ffadfca9eb4f7bd228cb72dfd1ec9b
2023-01-25 04:24:38 +00:00
Jon Robson
d4d6156c3b ResourceLoader: Basic client side user preferences
This allows the body classes of skins to be customized for anonymous
users. Enable using $wgResourceLoaderClientPreferences = true;

* Only classes of the form <prefix>-(disabled|enabled)
  can be toggled.
* For now no client side API is provided as this should not be
  considered stable.
* Storage mechanism is cookie, stored under "mwclientprefs"
* Preferences apply to all skins. This means setting a preference
  in Vector 2022  would also lead to class manipulation in Minerva.
  This is by design to allow for skin-agnostic preferences. Up to
  caller to make sure the class being manipulated is limited to the
  skin if required ie. don't use generic classes.
* Avoids try/catch and JSON parsing by storaging as a string
* Places inline script before body tag before first stylesheet to
  avoid breaking the article's ability to parse the article
  concurrently with stylesheet download.

Usage:
Given a document with classes
"client-js vector-feature-limited-width-enabled ext-feature-enabled"

Set:
    document.cookie = 'mwclientprefs=vector-feature-limited-width'

Will result in toggling off the limited width.

Bug: T321498
Change-Id: Ic3b6eec19953932c697ab5bf48c33a4ac1841b07
2023-01-25 02:24:35 +00:00
daniel
d9003dd275 Add dependency injection for Job classes
Introduces JobFactory

Bug: T245900
Change-Id: I094cc9325e5eaf2717ae510ef988a72407195224
2023-01-19 15:44:11 +00:00
Timo Tijhof
04a1760b54 poolcounter: Create PoolCounterFactory service class
* Allow for DI of config and PoolCounterConnectionManager.

* Manage the PoolCounterConnectionManager singleton without using
  a global/static field.

* Allow for test overrides (in ParserOutputAccessTest) without needing
  to bring all of ObjectFactory and 'factory' and thus exposing class
  constructors to stable interface (except not really since the args
  are hardcoded in practice).

Bug: T201223
Change-Id: I514fee20b388f04f9c85c5a1373845d621c65395
2023-01-19 07:33:58 +00:00
jenkins-bot
773d3b01b3 Merge "rdbms: Remove deprecation mark for $wgSharedDB" 2023-01-12 07:45:42 +00:00
Derick Alangi
99d989087d jobqueue: Warm parsoid parser cache using a job
This patch introduces ParsoidParserCachePrewarm job
that is used to warm PC with parsoid outputs in order
to speed up page reads on large wikis.

Bug: T322427
Change-Id: Ib63a02d3cf5348b36f4f166ff6939f4d2e7fef6f
2023-01-11 15:15:15 +01:00
Timo Tijhof
5771a64d2b rdbms: Remove deprecation mark for $wgSharedDB
This was marked as deprecated to indicate that it shouldn't be used
to share arbitrary database tables between wikis. However, this has
never been officially supported and so doesn't actually warrant
deprecation.

The only use case for $wgSharedDB that MediaWiki supports (and even
encourages in documentation) is for global accounts shared between
wikis.

Recently, update.php started to block upgrades when a deprecated
setting is used, which has brought this otherwise-innocent deprecation
comment to light. Remove it as such since the feature for which it
exists isn't deprecated, and we don't have any other (supported and
documented) ways of sharing accounts between wikis.

In the future, we might rename this and turn it into a boolean so
that it is easier to understand and maintain, but that's for another
day.

Bug: T308536
Change-Id: I1598630f2ab2c9bd443a5f3e6fc0997ceb52c5b2
2023-01-10 01:21:16 +00:00
jenkins-bot
a359d1dc06 Merge "Prepare migration from revision_comment_temp to rev_comment_id" 2023-01-09 21:02:49 +00:00
Alexander Vorwerk
cf12721101 Prepare migration from revision_comment_temp to rev_comment_id
This patch introduces a configuration variable that allows one
to control the migration stage in production.

Bug: T299954
Change-Id: I36f1e3cd9fb0f25fd43f4dbb97f791da5eb1147b
2023-01-02 22:33:16 +01:00
Umherirrender
1be1ea75e6 ReservedUsernames config: Add reserved names from maintenance scripts
This let migrateActors.php creating an actor id for it
(the script itself is already removed from 1.40 in c910301)

Bug: T223027
Change-Id: Id5c3b26bfdcd69391cf6f0d18423a5991ac8b887
2023-01-02 18:51:21 +01:00
Gergő Tisza
e486befd02 Add matrix: to $wgUrlProtocols
See <https://spec.matrix.org/v1.5/appendices/#matrix-uri-scheme>.

Bug: T326021
Change-Id: Ia931e5c51e07b06a9d04e80bdbd56131d506bd57
2022-12-30 21:57:33 +00:00
jenkins-bot
00b7eedc14 Merge "poolcounter: Merge Client and ConnectionManager from extension repo" 2022-12-19 00:18:31 +00:00
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
jenkins-bot
ba63a283ed Merge "docs: Improve docs around SpecialPage_initListHook" 2022-12-11 20:53:57 +00:00
Umherirrender
b3d065198e docs: Improve docs around SpecialPage_initListHook
Change-Id: I45410a4c7cf2feb99b24c06e9002ebbbfc66586f
2022-12-11 20:39:10 +00:00
daniel
090ec5777d Use services in WikitextContentHandler
Change-Id: I626b5ee9a070ad3a97ab9ac9f44cb7003d68bf13
2022-12-06 15:44:40 -05:00