Commit graph

11345 commits

Author SHA1 Message Date
jdlrobson
d3eda44624 registration: Make it easier to set a skin's templateDirectory
When originally introduced, a skin's templateDirectory was relative
to core, rather than the skin itself. Most skins needed to set
something like "skins/Example/templates", hardcoding the default value
of $wgStyleDirectory.

skin.json will now assume that the value of templateDirectory is
relative to the skin itself. If that directory doesn't exist, we'll
fallback and assume it's using the previous behavior of being relative
to core. In practice this should not be a breaking change since no skin
is expected to have a directory like "skins/Example/templates" inside
the skin itself.

Finally, ExtensionProcessor will set a default templateDirectory if
one isn't already set, so in most cases this setting should be able
to just be removed entirely.

Bug: T262067
Change-Id: I434b8a4319f3c8b65bcaab3465224058f31e7ae8
2021-08-27 00:22:38 -07:00
jenkins-bot
756bfc0962 Merge "Add tests for the UserRightsProxy" 2021-08-26 16:46:17 +00:00
jenkins-bot
81897f50b8 Merge "Promote SkinMustache methods to SkinTemplate" 2021-08-26 15:23:24 +00:00
jenkins-bot
d472229e8e Merge "In Rest\ResponseFactory, substitute invalid UTF-8" 2021-08-26 10:50:10 +00:00
Tim Starling
32a2be8ec4 A few extra tests for Linker::formatComment()
For better coverage of the new CommentParser.

Change-Id: I70d20c8c1d190e1edf2568b6b3d119ccbe105ae4
2021-08-26 16:54:40 +10:00
Tim Starling
2f6b427f40 In Rest\ResponseFactory, substitute invalid UTF-8
Most of the time this is due to garbage user input, and MediaWiki's
normal handling of user input strings is to normalize them, not to
throw.

There are some hypothetical cases where a developer might want to see an
exception, rather than passing garbage to the client and letting the
client fail, but normalization is a defensible policy and works within
the existing interfaces.

Bug: T289597
Change-Id: Ida5ee72c10d1c3499b5b17594c5675db7cd38335
2021-08-26 08:58:45 +10:00
jdlrobson
6c5b077830 Promote SkinMustache methods to SkinTemplate
Methods are promoted upwards from SkinMustache to SkinTemplate
in preparation for them being shared between SkinMustache and
BaseTemplate.

This is mostly a move of existing functions in SkinMustache but
also introduces SkinTemplate::getTemplateData and updates SkinMustache
to call the parent function.

Bug: T263213
Change-Id: I028364eb91e907c2f51529aac495df1eaca7b466
2021-08-25 15:39:26 +00:00
Roman Stolar
642afef215 Hard-deprecate Content::preSaveTransform.
Use ContentTransformer::preSaveTransform instead.
Extensions defining  a content model should override ContentHandler::preSaveTransform.

Bug: T287156
Change-Id: I2a8c60470366fd95d056e0dfa8144f209bb7117e
2021-08-25 16:14:59 +03:00
Alexander Vorwerk
b1973d9a2d Add tests for the UserRightsProxy
Change-Id: I6e369fe37cecd783b1ed163ccb36cc5d4b5182a4
2021-08-25 13:02:16 +00:00
jenkins-bot
7a957145ad Merge "Hard-deprecate Content::preloadTransform." 2021-08-25 11:26:03 +00:00
jenkins-bot
c03a36a48a Merge "Introduce concept of generateHTMLOnEdit() for ContentHandler" 2021-08-25 10:17:31 +00:00
Amir Sarabadani
66a4b414e5 Introduce concept of generateHTMLOnEdit() for ContentHandler
This way you can avoid rendering HTML and storing ParserCache entries

Bug: T285987
Change-Id: I3c7023b776f2a1e35dafdbb6ac0eb3eb73ae5fd4
2021-08-24 22:40:46 +02:00
jenkins-bot
89259d5a61 Merge "Inject services into Collation classes" 2021-08-24 17:53:21 +00:00
jenkins-bot
d7eb8c7d84 Merge "Fix namespace blocks of removed extension namespaces" 2021-08-23 12:46:51 +00:00
tsepothoabala
9cafcd885f Fix namespace blocks of removed extension namespaces
Bug: T280798
Change-Id: If6dc2a7d777121c072088cced1078803e10b79c9
2021-08-23 12:42:17 +02:00
Roman Stolar
335a3e162c Hard-deprecate Content::preloadTransform.
Use ContentTransformer::preloadTransform instead.
Extensions defining a content model should override ContentHandler::preloadTransform.

Bug: T287157
Change-Id: I766d793881812524fb9762292b7abedeb3cd0769
2021-08-23 13:25:42 +03:00
Fomafix
c7ebc1ec44 Fix various typos in documentation
Bug: T201491
Change-Id: I144c120cc88bda723c8608ed7fb0ccb709f295f1
2021-08-23 09:03:44 +00:00
jenkins-bot
98d28a1e8a Merge "rdbms: add unique key checks to upsert() and replace() in Database" 2021-08-23 06:57:33 +00:00
jenkins-bot
fae565a6eb Merge "Test row filtering for DeletedContribsPager" 2021-08-20 19:38:15 +00:00
TChin
dbe0d1f062 Test row filtering for DeletedContribsPager
Bug: T289266
Change-Id: I7c74d43c5df7ed1c1f577148844a439a6a8a13ff
2021-08-20 11:44:47 -04:00
jenkins-bot
03329fbc7a Merge "FormatJson: Add message for JSON_ERROR_INVALID_PROPERTY_NAME" 2021-08-20 09:14:26 +00:00
jenkins-bot
f1389b9670 Merge "MapCacheLRU: Remove redundant type checks in favour of native warnings" 2021-08-19 19:52:28 +00:00
jenkins-bot
288ee59492 Merge "MapCacheLRU: Add tests for getWithSet" 2021-08-19 19:52:22 +00:00
jenkins-bot
ec703402cc Merge "Test BacklinkCache" 2021-08-19 17:51:46 +00:00
TChin
de50954fdb Test BacklinkCache
Bug: T288614
Change-Id: I5a45bb0e7b179a1b545ed422fc2b6e7efd664d10
2021-08-19 17:29:05 +00:00
jenkins-bot
2eb25c0bdf Merge "resourceloader: Remove isFileModule() overhead from web requests" 2021-08-19 17:17:53 +00:00
DannyS712
4818a2e2ad ActionFactory: restore missing check for non-existent classes
Missed this part of the old Action::factory() method

Bug: T253078
Bug: T289190
Change-Id: Idb8fca0bc306ee9402ef7871b313d11eef176510
2021-08-19 14:22:11 +00:00
Aaron Schulz
acd3a53799 rdbms: add unique key checks to upsert() and replace() in Database
Disallow changing unique key values of rows in the upsert() assignment.
The unique key values are used to decide which new and old rows collide.
Changing these values at the same time is too complex and ill-defined.

Disallow setting NULL values for columns of the identity key in upsert()
and replace(), unless they are all NULL for all of the rows. This edge
case can be treated as a plain INSERT, assuming that conflicts are not
triggered over weird DEFAULT column values.

Update the corresponding IDatabase documentation.

Change-Id: If6e0cecce32a5eedaf9a82b67ba41296bfa4a317
2021-08-18 19:18:40 -07:00
jenkins-bot
da9f37a177 Merge "resourceloader: Add integration test for ResourceModuleSkinStyles" 2021-08-19 01:32:26 +00:00
Timo Tijhof
1367e356e7 resourceloader: Remove isFileModule() overhead from web requests
About 1.5% of load.php wall-time is spent in isFileModule() calls
during the ServiceWiring/getResourceLoader/register call early on.

Reduce the overhead of this cost by moving that logic to the Module
class.

There are two costs that we save this way:

1. The inherent cost of applying the skinStyles.

   This is now limited to only the modules that are constructed in a
   given web request. Thus, apart from the startup response (which
   constructs all modules), for regular load.php requests and all
   index.php page views, the vast majority of modules will never need
   to be constructed, and thus won't pay this cost.

2. The overhead of predicting (and class-loading) for whether a module
   is (or will become) a FileModule object.

   This is what isFileModule() does and is the main reason I wrote
   this patch. It involves class loading, and checks and conditions that
   run 1000+ times at WMF. This is eliminated now because we no longer
   have to calculate this decision. Instead, the logic applies when
   it needs to (due to FileModule implementing it), and doesn't
   when it doesn't!

Change-Id: Ia2db14f930800c96e767b94ef62fb00e9d52725b
2021-08-19 01:18:32 +00:00
Timo Tijhof
76245d70ff resourceloader: Add integration test for ResourceModuleSkinStyles
This was covered in small ways already, but we did not have coverage
of the registration logic where the skin attribute is injected into
the module info, and this then correctly getting read and composed
into a single stylesheet.

This is prep for an optimisation in a subsequent commit.

Change-Id: Ia6fff44a345bb4f5811956638cada8b3e6b6ea71
2021-08-19 01:14:00 +00:00
jenkins-bot
f533261dd4 Merge "Hard-deprecate Parser::mUser public access, Parser::getUser and ParserOptions::getUser" 2021-08-18 20:51:49 +00:00
jenkins-bot
3021bbd395 Merge "Apply side lock to diff headers and empty lines, too" 2021-08-18 19:02:24 +00:00
Timo Tijhof
74b4d669a7 MapCacheLRU: Remove redundant type checks in favour of native warnings
In commit 70c2223843, the explicit type checks were added as
exceptions because WMF's infra at the time didn't capture stacktraces
for the native warnings that PHP already emits.

That infra issue was resolved years ago (T45086), so we can remove
these again.

I've kept one manual type check, which is in setField, because for
$field in that method we don't first check existence (which emits
the warning normally), and because it does an assignment rather than
a key check, and assignments in PHP still have some invalid types
that don't emit warnings (specifically, booleans).

Bug: T275673
Change-Id: I72388f069afc345da9e9aac330733da49714d1b4
2021-08-18 00:10:10 +01:00
Timo Tijhof
880083a8b7 MapCacheLRU: Add tests for getWithSet
Bug: T275673
Change-Id: I473bd4becab6bdd16642bf41805bfd279af0a3c1
2021-08-18 00:10:10 +01:00
jenkins-bot
81c6f56c43 Merge "Revert "objectcache: make use of new modtoken field in SqlBagOStuff"" 2021-08-17 16:30:31 +00:00
vladshapik
1091f7753f Hard-deprecate Parser::mUser public access, Parser::getUser and ParserOptions::getUser
Bug: T285713
Depends-On: Ie75c9cd66d296ce7cf15432e2093817e18004443
Change-Id: I4297aea3489bb66c98c664da2332584c27793bfa
2021-08-17 15:42:05 +00:00
jenkins-bot
0640586f88 Merge "Move Content::preloadTransform to ContentHandler" 2021-08-17 15:37:12 +00:00
Ladsgroup
0bd5cf3910 Revert "objectcache: make use of new modtoken field in SqlBagOStuff"
This reverts commit d56a686f83.

Reason for revert: T288998#7287717

Bug: T288998
Change-Id: Ia05b00a345335fe8bdd6041323c3abfa79ded169
2021-08-17 15:29:32 +00:00
Roman Stolar
42442e01ff Move Content::preloadTransform to ContentHandler
Update ContentTransformer to access ContentHandler::preLoadTransform through the service.
Prepare object to hold a data that required for ContentHandler::preLoadTranform params.

This is a fully backwards compatible change.
We are doing hard deprecation via MWDebug::detectDeprecatedOverride.

However, with the ContentHandler calling Content and
Content calling ContentHandler, it doesn't matter whether
callers use Content or ContentHandler. This will allow us
to naturally convert all callers.

Bug: T287157
Change-Id: I89537e1e7d24c6e15252b2b51890a0bd81ea3e6b
2021-08-17 15:17:34 +00:00
Fomafix
6157bdaef0 CSSJanus: Update from version 1.3.0 to version 2.0.0
This version fixes a flipping bug.

Bug: T288943
Depends-On: Ida34372a4e5acb3147d83c7a1d008850c8382e32
Change-Id: I0528443e4eae0338f5a37491352db03944c6bd4c
2021-08-16 18:39:41 +00:00
Kevin Israel
b084f499db FormatJson: Add message for JSON_ERROR_INVALID_PROPERTY_NAME
The comment added in b9461e3f1c is incorrect. This is actually a
decode error, so is relevant to FormatJson::parse().

Change-Id: I3cc33f0f260c0ba4fe96fb75565f52d089b9a975
2021-08-16 10:57:14 -04:00
jenkins-bot
6f0f1b1c00 Merge "sparql: Replace deprecated Http::userAgent() in SparqlClient" 2021-08-13 21:32:43 +00:00
Petr Pchelko
dc321179c9 Utility in MWIntegrationTest to skip is extension not loaded
For testing extensions that optionally depend on other
extensions this is rather useful.

Change-Id: Id996abdb353547b95d795494ba961b9a215ef2ef
2021-08-13 18:39:31 +00:00
Alexander Vorwerk
60c3deaba1 RepoGroup: inject MimeAnalyzer
Change-Id: Ic3009b368b38d307d00dc3bec5c8d46b2dc97f83
2021-08-13 17:02:42 +02:00
Petr Pchelko
295557d1ae MockHttpTrait: support multiple MultiHttpClients
With mocking HTTP, we can supply an array of requests
to expect, but if MultiHttpClient or Guzzle client are
used, we can only supply one. Now we can mock a sequence
of requests done via either of these clients.

Change-Id: I350ed59af603a0504704af3265787a4be8f2dc2a
2021-08-12 11:30:14 -07:00
Daimona Eaytoy
38e40047e0 Apply side lock to diff headers and empty lines, too
Bug: T288676
Change-Id: Ia39df2647db3c1d010e0b84f161b369f71d7a728
2021-08-12 18:08:57 +02:00
jenkins-bot
0f76e5ad26 Merge "Hard deprecate UserLoadOptions hook" 2021-08-12 13:32:22 +00:00
jenkins-bot
372f4218b9 Merge "objectcache: BagOStuff::genericKeyFromComponents() empty component fix" 2021-08-12 01:45:25 +00:00
Aaron Schulz
f27367af09 objectcache: BagOStuff::genericKeyFromComponents() empty component fix
Empty leading components should still be colon separated. Although the
keyspace and collection should never be empty strings, it does not hurt
to handle that case anyway for safety.

Change-Id: Ic89acaf1fe5c34e58323b2913a9a26f973868590
2021-08-11 17:57:59 -07:00