Commit graph

953 commits

Author SHA1 Message Date
C. Scott Ananian
a8f20adc42 Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit 4d7cacfedc69ecac6e65f8d62f54583b900a54d2

Change-Id: I14d74032d09da1c6abf478e058e67c4040c1fcd0
2019-09-18 19:46:21 -04:00
Bartosz Dziewoński
18974098ef Remove unused localisation messages for old edit toolbar
Not used since cfa70ea6d0. Also not used
by any extensions (WikiEditor and VisualEditor have their own messages).

The message 'sig-text' used to also be part of the old edit toolbar,
but it is currently still used by WikiEditor.

Bug: T224429
Change-Id: I342351aaa2c69b5a7dde865edd38f1f2f94cfb8c
2019-09-18 14:53:48 +00:00
Brad Jorsch
c29909e59f Mostly drop old pre-actor user schemas
This removes most of the pre-actor user and user_text columns, and the
$wgActorTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_user and rev_user_text remain in the code, as on Wikimedia wikis the
revision table is too large to alter at this time. A future change will
combine that with the removal of rev_comment, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

ActorMigration's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process. Code using
ActorMigration for accessing the core fields should be updated to use
the new actor fields directly. That will be done for in a followup.

Bug: T188327
Change-Id: Id35544b879af1cd708f3efd303fce8d9a1b9eb02
2019-09-09 11:38:36 -04:00
Arlo Breault
00db615f85 Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit 06a41a99d7811a361446b894da7c5c8224398ad1

Change-Id: I9d324b3e6e9167683c15b7fee2a53b598d79a67c
2019-08-28 12:05:24 -04:00
jenkins-bot
786524a94a Merge "Let Html::element do the HTML encoding" 2019-08-28 06:57:34 +00:00
jenkins-bot
7b69a2b340 Merge "parserTests: Add parser test with filename containing single quotes" 2019-08-28 06:57:28 +00:00
Aryeh Gregor
5a6c18a086 LockManagerGroupFactory to replace singletons
100% test coverage of code that appears to be working and used, in both
LockManagerGroupFactory and also LockManagerGroup. Where possible I
wrote it as unit tests. One preexisting code path seems to be broken and
I marked the test as skipped. Two methods look unused and perhaps not
especially helpful, so I didn't write tests for them yet in case we want
to just get rid of them instead.

Change-Id: Iaa7354f31c451b87773468609c674a3bf1d4382f
2019-08-27 13:19:15 +03:00
Aryeh Gregor
752e7dd707 Convert MessageCache to service
Depends-On: Ia70e6c75f6e8a533f20cd44ebb05e013678e9951
Depends-On: I546eda0377f3a50843144b1450d3fbe8e4e02a8a
Change-Id: I305539a8598535a73e5cd280b2becdafa740ef97
2019-08-18 12:11:36 +03:00
Amir Sarabadani
807d793ab9 More clean up of oracle/mssql
Bug: T230418
Change-Id: I1ff01548e55f01f9419668e31d5aa7dd03d23258
2019-08-14 17:04:50 +02:00
Thalia
5f89f7040f Fix grammatical error in several comments
Change-Id: Ibd8ad594950d53f5feb337c30f184ecaf218bc81
2019-08-08 14:02:13 +01:00
Fomafix
7da70855fe Let Html::element do the HTML encoding
Also inline variables used once and move the htmlspecialchars to the
self::link call.

Change-Id: I6d9063af3f4ff0a6d70f3ebbce8362122d5bb06a
2019-08-07 23:51:41 +02:00
Fomafix
ec7ad5a554 parserTests: Add parser test with filename containing single quotes
This parser test reflects the current behavior of the parser with
filenames containing single quotes. The behavior can changed by future
changes of the parser.

Change-Id: I6dbeb6c1b8ab356d9d4372597957cd0ad01040a2
2019-08-07 23:50:56 +02:00
Gergő Tisza
ddffa1767f
Replace wfGetDB in ParserTestRunner
After I0d7dacee3, wfGetDB returns a connection reference instead of
a real connection, which means it can't be passed to CloneDatabase
anymore, and testcase / test runner classes should avoid it.

Bug: T228928
Change-Id: I42be4214e33a4d4f8d53fafc925c8d708b4c0106
2019-07-24 23:54:51 +02:00
jenkins-bot
3e74b6eeaa Merge "parser: add vary-revision-sha1 and related ParserOutput methods" 2019-07-17 23:57:17 +00:00
Aaron Schulz
dd6ed7840f parser: add vary-revision-sha1 and related ParserOutput methods
This can be used to avoid double parsed on save if the prior output
can be reused in-spite of involving a self content reference.

Change-Id: Idcd30a3fa3f7012dac76ce8bbf46625453ae331f
2019-07-17 05:12:18 +00:00
James D. Forrester
a8d26127ea Drop remnants of wgHtml5/wgJsMimeType/wgXhtmlDefaultNamespace support, killed in 1.22
Change-Id: I6bb849543fb3cfd50a4d99bb6a69e228913b9def
2019-07-15 12:52:12 -07:00
Derick Alangi
ff320d9e49 objectcache: Hard deprecate ObjectCache::getMainWANInstance()
This method was soft-deprecated in 1.28 and this patch cleans up
usage (via object cache) in core and uses services. So, this is now
fit for hard deprecation.

Usage
=====

https://codesearch.wmflabs.org/search/?q=getMainWANInstance&i=nope&files=&repos=

Change-Id: I081a979ed6ed7acf37168a6d81ca4048aae5dd9c
2019-07-09 09:29:57 +00:00
C. Scott Ananian
53fe91ded5 Hard deprecate Preprocessor_DOM
The Preprocessor_DOM implementation doesn't interact well with PHP memory
profiling, and has some limitations not present in the Preprocessor_Hash
implementation (see T216664).  There is no reason to keep around two
versions of the preprocessor: it just complicates on-going wikitext
feature development.

Hard deprecate use of Preprocessor_DOM, so we can remove the redundant
code in a future release.

Bug: T204945
Depends-On: Id38c9360e4d02b570996dbf7a660f964f02f1a2c
Change-Id: Ica5d1ad5b1e677542962fc36d582a793f941155e
2019-06-14 12:21:40 -04:00
Aryeh Gregor
2e1ac38485 Mass conversion to NamespaceInfo
Change-Id: I2fef157ceec772f304c0923a1cd8c0eef2e82a0f
2019-05-07 22:44:56 +02:00
Timo Tijhof
2bcd74d968 tests: Use standard utilities for temporary file names
Change-Id: Iff28c27990a81b02a92148a88256b9a25518f496
2019-05-06 17:21:45 +00:00
Aryeh Gregor
e6691999f4 Make RepoGroup a service instead of singleton
Change-Id: Id1661bf992ee7b7a1822f52fdfefe8e045b9f280
2019-05-06 13:57:40 +03:00
Aryeh Gregor
fb7d698365 Don't pass Config to NamespaceInfo
Change-Id: Ie43e6108c6b9bcb666b1dece055e0df689e2ec42
2019-05-06 11:31:34 +03:00
Aryeh Gregor
e6df285854 Remove all $wgParser use from core
Bug: T160811

Change-Id: I0556c04d33386d0339e02e2bf7a1ee74d97c2abd
2019-04-17 15:16:50 +03:00
Tim Starling
76ca6c9b18 Rehabilitate DateFormatter
This code is surprisingly little changed since I added the class in
November 2003, and needs some modernisation.

* Remove the "linked" option, unused since 1.21. Similarly, make the
  "match-whole" option implied. This allows the regexes to be
  simplified. Nothing will be broken, according to CodeSearch.
* Instead of ucfirst(), use the canonical month name from the language.
  This will work with e.g. French which does not capitalise month names.
* Stop caching DateFormatter instances in APC. Caching was added
  in 2005 when initialisation was being done on every request, but now
  it is only needed when parsing a page with {{#formatdate}}, which is
  rarely, and the constructor overhead is only 200µs after Language
  object data initialisation. Instead, use an in-process cache via a
  factory service.
* Add docs and extra tests.
* Remove todo note obsolete since 38 minutes after the original commit.
* Rename many variables.
* Use double-slash comments
* Don't store the Language object, just get arrays.
* Use mb_strtolower() instead of Language::lc() -- any customisation of
  Language::lc() would break PCRE case-insensitive matching.
* Use named subpatterns instead of "keys"
* Remove the ISO1/ISO2 distinction, the only difference was linking.
* Use closure variables instead of temporary object members

Change-Id: I25fb1203dba2930724d7bc28ad0d51f59f88e1ea
2019-04-10 21:00:04 +10:00
Aryeh Gregor
76661cf129 NamespaceInfo service to replace MWNamespace
MWNamespace::clearCaches() has been removed entirely, along with the
$rebuild parameter to MWNamespace::getCanonicalNamespaces(). The rest of
MWNamespace is deprecated.

Diff best viewed with -C1 so git notices that NamespaceInfo is a copy of
MWNamespace.

Depends-On: Icb7a4a2a5d19fb1f2453b4b57a5271196b0e316d
Depends-On: Ib3c914fc99394e4876ac9fe27317a1eafa2ff69e
Change-Id: I1a03d4e146f5414ae73c7d1a5807c873323e8abc
2019-04-10 02:07:36 +00:00
Thiemo Kreuz
2540c29b20 Use the ?? feature instead of isset() where it makes sense
Change-Id: I3a54f36b33d99ef3ff4c63e32e7dfcbcfc296135
2019-03-24 22:40:49 +01:00
Arlo Breault
c8f008e23e Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit 94b8b491098f882582f372218df07f5b68f4eba1

Change-Id: I760e73c98109047e20e4c85b97853b9b3f50b090
2019-03-19 11:36:08 -04:00
C. Scott Ananian
2a5397b53e Revert "Temporarily trim leading/trailing whitespace from parser test clauses"
This reverts commit 0363dbf98e6b71e92d439e0e2020bb388cc2aea2, since
T208070 is now merged.

Bug: T208070
Depends-On: I05511aee275238954f22db78616b19ce10cd6490
Depends-On: I120ca25a77b7b933de4afddd1d458e36a95e26da
Depends-On: I47d1d9620031036b9497cacf70b34a45c3e5f409
Depends-On: I6119b4af9632496dbda81c3a3951c55217e7c2d5
Depends-On: I584f74e2ba0d14c2975fb43cc53c5e26080e6fc7
Depends-On: Ie70e1915c172d2d67b3b8b90eb35f753b800f61e
Depends-On: I74953d5de765a2245a2999f17c7ae1cf49376bd1
Change-Id: I63f60b2e8beea9dde883c4ad65d0bd4411f93e70
2019-03-15 14:22:47 -04:00
Arlo Breault
a91757523a parser: Omit outputting newline after final line
Bug: T208070
Depends-On: I47d1d9620031036b9497cacf70b34a45c3e5f409
Depends-On: I6119b4af9632496dbda81c3a3951c55217e7c2d5
Depends-On: I584f74e2ba0d14c2975fb43cc53c5e26080e6fc7
Depends-On: Ie70e1915c172d2d67b3b8b90eb35f753b800f61e
Change-Id: I120ca25a77b7b933de4afddd1d458e36a95e26da
2019-03-15 14:22:45 -04:00
Arlo Breault
8384d48ae0 parser: Remove trailing newline after prefixes have been cleared
Bug: T208070
Depends-On: I74953d5de765a2245a2999f17c7ae1cf49376bd1
Change-Id: I05511aee275238954f22db78616b19ce10cd6490
2019-03-15 14:22:42 -04:00
C. Scott Ananian
19262326bb Temporarily trim leading/trailing whitespace from parser test clauses
This allows us to break a circular dependency in the patches for T208070.
It will be reverted as soon as T208070 is merged.

Bug: T208070
Change-Id: I3da235cb83efa424f0cf1cf4fc7233240fcdf6b2
2019-03-15 14:22:38 -04:00
Subramanya Sastry
a330f86543 Remove references to Html5Depurate
Change-Id: I4f07c5ae606f5c86242bb7d299f4f30a044860b4
2019-03-13 16:33:37 -05:00
Max Semenik
1e9db557d7 Remove $wgMediaInTargetLanguage
It's a temporary feature flag not included in any release, just
removing it outright. The functonality will now be always enabled.

Bug: T205040
Change-Id: Ia9da82e6f6b2d270f1790a99fc8c35ad5e6aee5e
2019-03-08 15:24:39 -08:00
Max Semenik
24ed00e74e ParserTestPrinter: use Shell class
Change-Id: I9e2eb3b01a9907d72e3edaa6660a4057d513942e
2019-02-09 22:25:57 -08:00
Brad Jorsch
0abb9338f8 Mostly drop old comment schemas
This removes most of the pre-CommentStore text columns, and the
$wgCommentTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_comment remains in the code, as on Wikimedia wikis the revision
table is too large to alter at this time. A future change will combine
that with the removal of rev_user_text, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

CommentStore's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process.

Bug: T166733
Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
2019-02-07 16:59:27 +11:00
Subramanya Sastry
d3d9b4f09c Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit 391acbfe0c93d632727ea08cd2a10b4dba8c257f

Change-Id: I0e8c154eaf118f9cd5b58d657f64d0829a65c8f0
2019-01-02 16:10:30 +00:00
Gilles Dubuc
4a79eefc78 Make thumbnail image decoding async
This is a browser hint indicating that decoding of the image can be done
asynchronously (instead of synchronously during the image's onload event).
Marking decoding as async enables the browser to display any other
non-image content that might be waiting to be rendered, without waiting
for the image to be decoding. This should allow text to appear sooner in
some situations, where the browser would have otherwise waited to
bundle its rendering with an image. The final result (non-image + image
content being displayed) will happen at the same time as before.

Given how text-heavy wiki context usually is, it makes sense to allow
users to see the text sooner in some situations, so they can start reading.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decoding
https://html.spec.whatwg.org/multipage/images.html#decoding-images

Bug: T212124
Change-Id: I3d738eba016bad486194f032a47ac6312f61c34e
2018-12-20 13:20:54 +01:00
Lucas Werkmeister
8e9f529cdb Use singular they to refer to IP address
The previous “him/her” does not cover all pronouns people might use, and
is also at odds with how MediaWiki usually addresses users whose gender
is not known.

Change-Id: I468fbd25ab80f21eb591c349117774fe8ce2d9dc
2018-12-13 17:41:36 +01:00
jenkins-bot
bd78869618 Merge "No yoda conditions" 2018-12-09 01:34:23 +00:00
jenkins-bot
9ff8e0a946 Merge "Remove most support for configuring Tidy, including Raggett" 2018-12-05 18:59:50 +00:00
Subramanya Sastry
76396ff888 Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit 5eb1690104ff70e0bd090b5cb93900b4be766377

Change-Id: I051ff481147d9a2189442f885131b47a6c00d373
2018-12-03 16:05:28 -06:00
Kunal Mehta
1706d353ae Don't link wikilinks in section heading autocomments
Previously, a manually constructed autocomment in the form of
/* [[Some link]] */

would create a link to the the section, and then the "Some link" page.

After T165189 was implemented, the entire autocomment is now a link to
the section, so we're creating links inside of a link...which is
problematic. In most contexts (history and watchlist particularly), the
section link is more important than the title in the section heading, so
that's what we'll favor here.

It's worth noting that this situation is a manually created edge case.
Even if the section heading is a wikilink, the edit summary will
autofill a section autocomment without the double brackets.

We'll now render the double brackets ([[...]]) and not link them. This
is what the user literally typed, and matches the existing practice of
rendering templates in section headings with their literal syntax. And
as a bonus, it's still possible for user scripts such as wikEdDiff to
turn the rendered double brackets into a real link if users want.

Bug: T165189
Change-Id: Ib10679edd76c72a60d7e1c89fc8454166e34c463
2018-12-03 12:43:03 -08:00
Kunal Mehta
0c9cf24b05 Restore old HTML structure for history section links
A follow-up to 0a8e16d7cf thanks to Anomie's code review.

The section title is now inside <span dir="auto"> and <span
class="autocomment">, as before. $wgLang->getDirMark() between the arrow
and the text was restored.

Given the comment
 /* External links */ removed bogus entries
the HTML before 0a8e16d7cf looked like:
 <a href="#External_links">→</a>‎<span dir="auto"><span
 class="autocomment">External links: </span> removed bogus entries</span>
after this change, it will look like:
 <span dir="auto"><span class="autocomment"><a
 href="#External_links">→‎External links</a>: </span> removed bogus
 entries</span>

The issue of having links be inside other links will be addressed in a
separate patch.

Bug: T165189
Change-Id: I31d87a87ccaf50de58fdd0621c46133b2881b490
2018-12-03 12:42:56 -08:00
jenkins-bot
7ddab17aac Merge "Accept BCP 47 codes in LanguageConverter rules" 2018-11-27 18:49:25 +00:00
Subramanya Sastry
fbe6b633b7 Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit 463678ed5c83764a3558fec13cea07825a4fddd4

Change-Id: I5bd67b9f20ee9cda2c1141670ab140d65f8a2cc0
2018-11-27 12:10:47 -05:00
jenkins-bot
c984a1f2f8 Merge "Quoted attributes don't need to be followed by a space" 2018-11-27 16:21:41 +00:00
jenkins-bot
4077b57759 Merge "Parse wikitext in gallery caption" 2018-11-27 15:47:50 +00:00
C. Scott Ananian
f87898b488 Protect legacy URL parameter syntax in link and alt options
HTML doesn't allow certain semicolon-less HTML entities in attribute
values to avoid breaking legacy markup like:
  <a href="http://example.com?foo&param=bar">...</a>
(Note that the & in that URL is not properly entity-escaped as `&amp;`.)

Unlike wikitext, HTML generally allows semicolon-less legacy entities
in text.

Our alt and link option processing shove text through
Sanitizer::stripAllTags, which does entity decoding including these
legacy semicolon-less entities.  Wikitext doesn't allow semicolon-less
entities, so escape & characters where appropriate to protect alt/link
options and avoid breaking URLs.

This was a "regression" in how alt options were handled starting in
ddb4913f53 when we switched to using
Remex for Sanitizer::stripAllTags -- semicolon-less entities (previously
invalid in wikitext) were now being decoded when stripAllTags was
called on alt text.  This change became a problem when
ad80f0bca2 sent link option text through
Sanitizer::stripAllTags (with the new semicolon-less entity decode)
instead of PHP's strip_tags (which, in addition to its other faults,
doesn't do entity decode at all).  This suddenly started decoding
"non-wikitext" entities like `&para` inside URLs, breaking links.
Filed T210437 as a follow-up to consider changing the behavior
of Sanitizer::stripAllTags() globally to prevent it from decoding
semicolon-less entities for all callers.

Bug: T209236
Change-Id: I5925e110e335d83eafa9de935c4e06806322f4a9
2018-11-27 10:12:05 -05:00
Subramanya Sastry
72fd6adca7 Sync up with Parsoid parserTests.txt
This now aligns with Parsoid commit c900a0c7dbd27cdba09d43971411e6849be73558

Change-Id: I7d7049e4cfbe50d7fe9c90894a6879e1694a3078
2018-11-26 10:15:12 -05:00
Bjornskjald
0a8e16d7cf Make "→" link to page section on History page larger by adding section name to it
Bug: T165189
Change-Id: I1f845592bd3de342fda84b60fc412055973950fd
2018-11-24 03:22:16 +00:00