Commit graph

14677 commits

Author SHA1 Message Date
Fomafix
4f71fcdfcc Remove the executable flag from test files
chmod a-x tests/phpunit/data/MSCompoundFileReader/*

Change-Id: Ic2fa5f118b40126bea429d2299563c03fe6b3d1a
2021-10-16 11:23:02 +00:00
jenkins-bot
93821348aa Merge "Allow using a reverse proxy for local HTTP requests" 2021-10-16 04:41:08 +00:00
C. Scott Ananian
4834340ec0 Deprecate ParserOutput::addWarning() in favor of ::addWarningMsg()
Encourage localization and factor out common code by taking a message
key as the first argument to ::addWarningMsg() instead of a wikitext
string.  This also plays nicer with Parsoid by separating out the
localization code from the parse.

Bug: T293515
Change-Id: I6a7c04c67ac586ab00d4edcbb3d09485a7794e23
2021-10-15 16:06:13 -04:00
C. Scott Ananian
6bf78153bf Hard deprecate ParserOutput::addTrackingCategory()
Non-WMF-deployed patches:
I403b646852064fed22e8e9bbfadd221990363881 (CollaborationKit)

Code search:
https://codesearch.wmcloud.org/search/?q=%5BOo%5Dutput%28%5C%28%5C%29%29%3F-%3EaddTrackingCategory%5C%28&i=nope&files=&excludeFiles=&repos=

Depends-On: I339a14907c8059c52ffce5d8a554e97f1f0b58d6
Depends-On: Ie6a09796b908dd105ec17d5a1f0f9586eed9bd8c
Depends-On: I983d370a03413086acafe7e67a2b812400e1a38d
Depends-On: Ie41ad70f1fb5de202355314a96a1243234fb267c
Depends-On: I715f788c5026a6c07d4995980a4fcc6c8b84e2b4
Depends-On: I1330a806febf898b3a0a2998fac857f0f737a0a3
Change-Id: I340c138f26e25ce971a46470a4da02d011b5a638
2021-10-15 14:18:26 -04:00
C. Scott Ananian
9632dfb041 Move ::addTrackingCategory() implementation to TrackingCategories
This moves the implementation of ParserOutput::addTrackingCategory()
to the TrackingCategories class as a non-static method. This makes
invocation from ParserOutput awkward, but when invoking as
Parser::addTrackingCategory() all the necessary services are
available.  As a result, we've also soft-deprecated
ParserOutput::addTrackingCategory(); new users should use the
TrackingCategories::addTrackingCategory() method, or else
Parser::addTrackingCategory() if the parser object is available.

The Parser class is already kind of bloated as it is (alas), but there
aren't too many callsites which invoke
ParserOutput::addTrackingCategory() and don't have the corresponding
Parser object handy; see:

https://codesearch.wmcloud.org/search/?q=%5BOo%5Dutput%28%5C%28%5C%29%29%3F-%3EaddTrackingCategory%5C%28&i=nope&files=&excludeFiles=&repos=

Change-Id: I697ce188a912e445a6a748121575548e79aabac6
2021-10-15 14:17:58 -04:00
Kunal Mehta
cc241c2add Allow using a reverse proxy for local HTTP requests
$wgLocalHTTPProxy can be used to configure a reverse proxy
for requests to domains in $wgLocalVirtualHosts. The previous
implementation of using it as a proper HTTP proxy is no longer
supported and has been reverted out of REL1_37 (856da72363d1ba8bf).

It sets the hostname of the request as a "Host" header, scheme as
"X-Forwarded-Proto" and then sets the proxy's scheme, host and port as
those of the request.

Bug: T288848
Change-Id: Ibc3616f5ad925d464d937ab15461a88619c8b7a7
2021-10-15 10:56:46 -07:00
C. Scott Ananian
5ae946d3a6 Rename ParserOutput::setCategoryLinks() and ::getCategoryLinks()
Make ::setCategory() consistent with the corresponding singular method,
which is ::addCategory(), not ::addCategoryLink().  Also, don't return
a value.

This renaming is in preparation for factoring out a write-only base
class from ParserOutput suitable to be used by Parsoid.

Note that OutputPage does distinguish a 'category link' from a
'category list', and there are separate OutputPage::getCategories()
and OutputPage::getCategoryLinks() methods.  However, the category
map in ParserOutput isn't exactly the same as either of these:
it's actually a map (or list of pairs) of category name to sort key.

Rename ParserOutput::getCategoryLinks() to ::getCategoryNames()
in order to clarify that the concept involved is not the same as
the OutputPage "category links" methods.

Code search:
https://codesearch.wmcloud.org/deployed/?q=-%3E(get%7Cset)CategoryLinks%5C(&i=nope&files=&excludeFiles=&repos=

(Note that many of the code search matches are for the methods in
OutputPage, which we are trying to disambiguate here.)

Bug: T287216
Change-Id: Idb383d3d9ef7b76f8a0208a057a3cb8c639465c9
2021-10-15 09:45:36 -07:00
jenkins-bot
6f8e9f9680 Merge "tests: MWHttpRequestTest is a unit test, not an integration test" 2021-10-14 23:45:14 +00:00
jenkins-bot
ba70412496 Merge "Add message parameter type for User Groups" 2021-10-14 20:12:19 +00:00
TChin
fb4e7a803a Add message parameter type for User Groups
Bug: T278482
Change-Id: I45da5f73f8920b79b57c02776a05d0268d3480f2
2021-10-14 15:02:13 -04:00
Fomafix
e86f180bd4 Merge "Encode & to & in displaytitle fallback" 2021-10-14 17:58:06 +00:00
jenkins-bot
4ed5508f02 Merge "Move parser test with stray carriage return to extraParserTests.txt" 2021-10-14 16:46:51 +00:00
jenkins-bot
8ab400e920 Merge "Sanitizer: Replace RFC 3454 by RFC 8264 for clearUrl" 2021-10-14 16:15:44 +00:00
jenkins-bot
388e5f200c Merge "Sanitizer: Use \u{xxxx} syntax in cleanUrl" 2021-10-14 16:07:43 +00:00
jenkins-bot
2504a3bb68 Merge "ParserOutput: remove Title from public interface" 2021-10-14 16:02:28 +00:00
daniel
845b36c7bb ParserOutput: remove Title from public interface
Usages of Title in the public interface of ParsrOutput are being
replaced with LinkTarget or PageReference, as appropriate.

Change-Id: I571cf18fd7e666a59ef3947b09c2e75357bcac04
2021-10-14 10:46:53 +00:00
jenkins-bot
f32e15c3f1 Merge "Make Parser::$mStripState private" 2021-10-14 03:10:56 +00:00
Timo Tijhof
15964c6682 mediawiki.base: Add tests for mw.log.deprecate()
Bug: T292489
Change-Id: Iad4ea58a53ca3a97f57a36684eb1c8bc0e2996bf
2021-10-14 01:14:04 +00:00
C. Scott Ananian
3056737420 Make Parser::$mStripState private
This property was deprecated in 1.35.  The replacement function
Parser::getStripState() was introduced in MediaWiki 1.34.

Code search:
https://codesearch.wmcloud.org/search/?q=-%3EmStripState&i=nope&files=&excludeFiles=&repos=

Depends-On clauses below are for WMF-deployed code.  Other uses in
non-WMF-deployed code have been patched in:
* https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/4936
* Idc2fadf5105d6eb30777a16dff0035bceff17174 (BlueSpiceSocial)
* I130fd61a8fe2d28e6b116a3fcc767b8abd466cea (ContributionScores)
* I3676fe9882ce9de5732cb7230528134df544ff98 (HierarchyBuilder)
* Ic392afd1e93ae0003fd0ab65114ec1ff38bb2927 (Mpdf)
* I4b01017da752def982777c4fea5fad5e21e4c7ea (MsLinks)
* I09726078ee62eb99e032b8faa5f938e20107f48c (Negref)
* Ibfd6b7064a8e650c3492e0d2764d4f7afc4937bf (PageForms)
* Ia865435688d36178508f21cffae79538c919035c (PageInCat)
* Ib94db0e6d365e4cb3f51121340a04d31b88add62 (ParserFun)
* I8660c0691b7e9842106d7dcb224ff5ecf374e4bc (PhpTags)
* I1ad5f78e5a937767123400ceca4967941e256e5e (RandomImageByCategory)
* I4539e7cea597f71b2a2d9a6cae137bc25085ed6b (ReplaceSet)
* If8ff2e21952b3f08d3a8950d42e2afb56973fb89 (SemanticDrilldown)
* I4a5bd64760cdde5b614a7d4e2b09e8d0634b2056 (SemanticPageSeries)
* Ia04f1aac1d8ae4ea16c98cfbbe72195fffe653b6 (SemanticRating)
* Id2a2e2d024922e3babf756ebae1a4f59b4358146 (Spark)
* I4a979024b18ec4834dc06b51ee0f018d749c6dab (Tooltip)
* Iaf179914863998b32bfecc16c874c3cffd6c26e9 (VIKI)
* I2de0e7a6c133c2e1f3cb7502a81d809c4489db4c (XSL)
* https://gitlab.com/hydrawiki/extensions/characterescapes/-/merge_requests/1 (characterescapes)
* https://github.com/JeroenDeDauw/Validator/pull/38 (Validator)
* https://github.com/lingua-libre/CustomSubtitle/pull/3 (CustomSubtitle)
* https://github.com/mkroetzsch/AutoCreatePage/pull/12 (AutoCreatePage)
* https://gitlab.com/nonsensopedia/extensions/advancedbacklinks/-/merge_requests/95 (advancedbacklinks)
* https://github.com/vonloxley/Shariff-Mediawiki/pull/16 (Shariff-Mediawiki)

Bug: T275160
Depends-On: I062ac8b69756a7ad35d8cc744b4735fd2e70f13e
Depends-On: Ic4be2bad176f2c59a1104219be10045cd5929261
Depends-On: I3cb117a91c8c57331b6b513f64ddb68d6ae2758c
Depends-On: I67b5926f2f851b3dc709d044eec5dd3df5065482
Depends-On: I7806068e1cd6e4da66adfe7bb75095d4bfb5d6bc
Depends-On: I429da35ca4e276c852b8d6ee102ff19f742c22c0
Change-Id: I4af85a46cfcafba15aa5ee50fda9f7b04681d6e6
2021-10-13 19:58:50 -04:00
jenkins-bot
339f21e9c8 Merge "Reduce microtime()/mt_rand() fragility in WANObjectCacheTest" 2021-10-13 23:53:55 +00:00
Bartosz Dziewoński
3223981217 Move parser test with stray carriage return to extraParserTests.txt
All of my favorite text editors corrupt this test case whenever I edit
parserTests.txt. extraParserTests.txt contains other tests with weird
characters that may get corrupted by normal text editors.

(I had to use `vi` to make this patch, and I wouldn't wish this on
anyone.)

Change-Id: Id474469180fc284e3e28b55f65808be727507875
2021-10-14 00:49:58 +02:00
jenkins-bot
5e54ab5c02 Merge "resourceloader: Remove obsolete logic for handheld=yes pageviews" 2021-10-13 22:28:54 +00:00
Petr Pchelko
a1aa3e0827 Hard-deprecate all public property access on CacheTime and ParserOutput.
- Added a test where ParserOutput objects with CacheTime
properties set are unserialized from previous versions.
- Generate new serialization tests for 1.38

Now all serialization in production is JSON, so changing
property visibility shouldn't affect ParserCache.

Bug: T263851
Depends-On: I283340ff559420ceee8f286ba3ef202c01206a23
Change-Id: I70d6feb1c995a0a0f763b21261141ae8ee6dc570
2021-10-13 13:27:16 -04:00
Petr Pchelko
4d54b4caa0 Run ParserOutput serialization tests against latest example available
In ParserOutput serialization tests we have a large number of examples
saved for different versions of MW. When MW version is released,
but the serialization doesn't change, we stop running some serialization
tests cause we can no longer find the latest example.

Change-Id: I01e8e0e17e2371b2cd08d200d3a4611d814e74bb
2021-10-13 13:26:47 -04:00
jenkins-bot
ad9255fe30 Merge "Remove deprecated ApiBase::PARAM_VALUE_LINKS" 2021-10-13 01:54:56 +00:00
Alexander Vorwerk
0a86c3655d phpunit: Fix parameter order on two assertSame() calls
The first parameter of assertSame() is the expected value, the second
one the actual value.

Change-Id: I5a411403443f18b30c93ab9552f625a70c75f75c
2021-10-12 20:22:34 +00:00
jenkins-bot
ce1c6b7002 Merge "Migrate WikiPage::doEditUpdates() to using PageUpdaterFactory" 2021-10-11 11:36:50 +00:00
Aaron Schulz
278bcbb7a6 Reduce microtime()/mt_rand() fragility in WANObjectCacheTest
Tweak testLockTSESlow() tests to reduce mt_rand() dependency.

Also, rename last few $now variables to $mockWallClock and use
integral floats to make it easier to find raw microtime() values
via debugging statements.

Change-Id: Ie2b125e42d3ac37104f5b87b75a9a81558956518
2021-10-09 03:16:57 +00:00
jenkins-bot
dfd0c73975 Merge "RCFilters: Merge mediawiki.rcfilters.filters.dm into ui module" 2021-10-09 02:43:33 +00:00
DannyS712
bad94719a8 RCFilters: Merge mediawiki.rcfilters.filters.dm into ui module
The new module retains the name .ui name so that existing
skin style overrides continue to work. We can consider renaming it
to just "mediawiki.rcfilters.filters" in a future patch.

This does not handle file reorganization, since both of the
modules used package files - instead, in the main script we also
require() the old main script for the .dm module so that its
setup code runs. But, we did need to rename the virtual
config file from the .dm module to not clash with the
virtual config file from the .ui module, since the
latter uses a callback instead of retrieving configuration
variables directly. These can be merged later as well.

Bug: T256836
Change-Id: I5ec0af8b8e6bcdba6b7881f946f777b854a33739
2021-10-09 02:23:13 +00:00
Timo Tijhof
d457762706 resourceloader: Remove obsolete logic for handheld=yes pageviews
This feature was removed in 2013 (Ia8d79b4a, T49504), with further
remnants removed in (1965df8df3, I7c24128f7b1).

* Simplify the code of transformCssMedia() as it now only needs to
  support printable=yes.
* Remove query parameter abstraction from test cases, use query
  array directly.
* Remove internal use of the $handheld parameter.
  Function signature of makeLoaderQuery() left in-tact for
  compatibility with $extraData. This will be deprecated and removed
  in a follow-up commit.

Bug: T49504
Bug: T32956
Change-Id: Id16ef3f4630538de1887ac2327eb317c6c6b1f9d
2021-10-09 02:47:39 +01:00
Reedy
fb235068b8 Remove deprecated ApiBase::PARAM_VALUE_LINKS
Change-Id: I1c544ef58ebb2c83ebdcf7284a8dad2ed364c608
2021-10-09 01:44:42 +01:00
jenkins-bot
83d7e03366 Merge "Fix height of traditional galleries in new media dom" 2021-10-08 21:09:00 +00:00
Kunal Mehta
e7a4225596 tests: MWHttpRequestTest is a unit test, not an integration test
Change-Id: Iea8aff749c4e7da3fbfb0f6c3fbefd450d9a3b6a
2021-10-08 12:24:34 -07:00
Arlo Breault
2845964ff8 Fix height of traditional galleries in new media dom
Follow up to Iff2bdc3aa02f84f0bf4ca55d177706823934cc08

This corrects an omission from the previous patch, aligning it with Parsoid's output.

Change-Id: Ic64af85f5969717a4ea536a695874359a13645c5
2021-10-08 17:57:44 +00:00
jenkins-bot
cd9c0ba6c0 Merge "Rename ParserOutput::{get,set,unset}Property to {get,set,unset}PageProperty" 2021-10-08 14:47:30 +00:00
C. Scott Ananian
af5d13c5de Rename ParserOutput::{get,set,unset}Property to {get,set,unset}PageProperty
The ::getProperty() naming is too generic and doesn't clearly indicate
that these are "page properties" (which have their own table in the DB).
As part of refactoring a clean API out of ParserOutput which can be used
by Parsoid, clean up the naming here.

Soft-deprecation in this patch, there are a handful of external users
which need to be cleaned up before we hard-deprecate.

Bug: T287216
Change-Id: Ie963eea5aa0f0e984ced7c4dfa0fd65d57313cfa
2021-10-08 10:07:17 -04:00
jenkins-bot
af9bbfe40f Merge "mediawiki.String: Add new functions lcFirst and ucFirst" 2021-10-07 22:28:35 +00:00
jenkins-bot
dad4e4237e Merge "Tweak Tidy handling in editTests.php" 2021-10-07 21:57:21 +00:00
jenkins-bot
c65c7e4039 Merge "phpunit: Drop bypass for now-fixed dberror from SpecialPageFatalTest" 2021-10-07 20:29:42 +00:00
Subramanya Sastry
acc7c9b1b1 Tweak Tidy handling in editTests.php
* Tidy is always enabled, so enable/disable tidy checks not needed
* +tidy parsertest options are gone. So, tweak how output sections
  are switched around.

Bug: T198214
Change-Id: I735a9dc2979bcc165423bfdc3ffca12c5602e2c1
2021-10-07 15:23:47 -05:00
Derick Alangi
6407361b46 Migrate WikiPage::doEditUpdates() to using PageUpdaterFactory
WikiPage::doEditUpdates() has been deprecated. Using the PageUpdaterFactory's
newDerivedPageDataUpdater() is the new way forward. Also, I made sure to have
the `$options` array with the `causeAction` and `causeAgent` key/value pairs.

Change-Id: I9f2c212d7c83a46799f9f947dc372dc364289680
2021-10-07 11:17:43 +01:00
DannyS712
736e00ee8c resourceloader: omit noscript module from client registry
In all cases where the client registry is used, the `noscript` module
is inapplicable. Additionally, make it illegal to have a module
include the 'noscript' module as a dependency.

Bug: T291735
Change-Id: I5846f2c19b003989b56b12628b385fd37049483b
2021-10-07 01:21:02 +00:00
James D. Forrester
c2b52ea1fb api-testing: Adjust DiffCompare expected outcome to cope with new wikidiff2 output
The library now adds 'diff-side-added' and 'diff-side-deleted'.

Bug: T292676
Depends-On: If4bc60c35403799de4e330103d8aaa6f039d96fe
Change-Id: Id92aee4029f008402d9d331876c81fe2263580a7
2021-10-06 22:30:15 +00:00
James D. Forrester
b4efcdf49a Drop $j alias for $, deprecated since 1.23
Bug: T280944
Change-Id: Ifb41d35d0d08b3c0631040b2f52d856de51adc67
2021-10-06 08:43:40 -07:00
Ed Sanders
ca846e35cc ParamValidator: Define extra parameters for ExpiryDefTest
This will be tested via ParamValidatorTest->testCheckSettings().

Change-Id: I4e1d24eb0abd88b370165a63a1c1e694edd25996
2021-10-05 16:30:49 -07:00
jenkins-bot
e7f4484611 Merge "Make first char of username in ApiQueryAllUsers case-insensitive" 2021-10-05 20:57:54 +00:00
jenkins-bot
e5b8997536 Merge "Remove "auto-number headings" preference" 2021-10-05 19:18:40 +00:00
Fomafix
eed3121a8f Encode & to & in displaytitle fallback
The value in the attribute displaytitle must contain valid HTML. The
sanitizer of the {{DISPLAYTITLE}} parser ensures that only valid HTML
is accepted.

If there is no {{DISPLAYTITLE}} in the wikitext then displaytitle
falls back to $title->getPrefixedText(). Here an HTML encoding of
special characters is necessary. This affects only the replacement of
& by &amp; because other special characters like < and > are not
allowed in the title.

This change affects the displaytitle fallback on the following places:
* ApiParse
* ApiQueryInfo
* InfoAction
* Parser

The displaytitle fallback in OutputPage is also updated to this
behavior although
Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $html )
also replaces & by &amp;.

Also add test cases with & in the displaytitle to:
* ApiParseTest
* ApiQueryInfoTest
* parserTests

Bug: T291985
Change-Id: I8ee1e2731d9bfa49725d663b34986e7e3073e4ca
2021-10-05 18:09:15 +00:00
jenkins-bot
dcd793203b Merge "Use PageUpdater's fluent interface" 2021-10-05 12:30:37 +00:00