| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
== Skin::wrapHTML ==
Skin::wrapHTML no longer has to perform any guessing of the
ParserOutput language. Nor does it have to special wiki pages vs
special pages in this regard. Yay, code removal.
== ImagePage ==
On URLs like /wiki/File:Example.jpg, the main output handler is
ImagePage::view. This calls the parent Article::view to handle most of
its output. Article::view obtains the ParserOptions, and then fetches
ParserOutput, and then adds `<div class=mw-parser-output>` and its
metadata to OutputPage.
Before this change, ImagePage::view was creating a wrapper based
on "predicting" what language the ParserOutput will contain. It
couldn't call the new OutputPage::getContentLanguage or some
equivalent as Article::view wouldn't have populated that yet.
This leaky abstraction is fixed by this change as now the `<div>`
from ParserOutput no longer comes with a "please wrap it properly"
contract that Article subclasses couldn't possibly implement correctly
(it coudln't wrap it after the fact because Article::view writes to
OutputPage directly).
RECENT (T310445):
A special case was recently added for file pages about translated SVGs.
For those, we decide which language to use for the "fullMedia" thumb
atop the page. This was recently changed as part of T310445 from a
hardcoded $wgLanguageCode (site content lang) to new problematic
Title::getPageViewLanguage, which tries to guestimate the page
language of the rendered ParserOutput and then gets the preferred
variant for the current user. The motivation for this was to support
language variants but used Title::getPageViewLanguage as a kitchen
sink to achieve that minor side-effect. The only part of this
now-deprecated method that we actually need is
LanguageConverter::getPreferredVariant().
Test plan: Covered by ImagePageTest.
== Skin mainpage-title ==
RECENT (T331095, T298715):
A special case was added to Skin::getTemplateData that powers the
mainpage-title interface message feature. This is empty by default,
but when created via MediaWiki:mainpage-title allows interface admins
to replace the H1 with a custom and localised page heading.
A few months ago, in Ifc9f0a7174, Title::getPageViewLanguage was
applied here to support language variants. Replace with the same
fix as for ImagePage. Revert back to Message::inContentLanguage()
but refactor to inLanguage() via MediaWikiServices::getContentLanguage
so that LanguageConverter::getPreferredVariant can be applied.
== EditPage ==
This was doing similar "predicting" of the ParserOutput language to
create an empty preview placeholder for use by preview.js. Now that
ApiParse (via ParserOutput::getText) returns a usable element without
any secret "you magically know the right class, lang, and dir" contract,
this placeholder is no longer needed.
Test Plan:
* EditPage: Default preview
1. index.php?title=Main_Page&action=edit
2. Show preview
3. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>
* EditPage: JS preview
1. Preferences > Editing > Show preview without reload
2. index.php?title=Main_Page&action=edit
3. Show preview
4. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>
5. Type something and 'Show preview' again
6. Assert old element gone, new text is shown, and new element
attributes are the same as the above.
== McrUndoAction ==
Same as EditPage basically, but without the JS preview use case.
== DifferenceEngine ==
Test:
1. Open /w/index.php?title=Main_Page&diff=0
(this shows the latest diff, can do manually by viewing
/wiki/Main_Page, click "View history", click "Compare selected revisions")
2. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>
3. Open /w/index.php?title=Main_Page&diff=0&action=render
4. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>
== Special:ExpandTemplates ==
Test:
1. /wiki/Special:ExpandTemplates
2. Write "Hello".
3. "OK"
4. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>
Bug: T341244
Depends-On: Icd9c079f5896ee83d86b9c2699636dc81d25a14c
Depends-On: I4e7484b3b94f1cb6062e7cef9f20626b650bb4b1
Depends-On: I90b88f3b3a3bbeba4f48d118f92f54864997e105
Change-Id: Ib130a055e46764544af0f1a46d2bc2b3a7ee85b7
|
| |
| |
| |
| |
| |
| |
| |
| | |
This ensures that the watcher follows the ParserOutput even if it gets
replaced when it is passed by reference to Content::fillParserOutput()
and/or ContentHandler::fillParserOutput().
Change-Id: I69102f841437e30d93ca1da0b71bc08c3f18cb96
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no security benefit from encoding &, it's perfectly safe in
JavaScript (it likely dates from XML/XHTML requirements).
Newly created redirects will use a literal & in these URLs, while
continuing to support use of \u0026 for existing pages.
Note that this is about use of & for query parameter seperators, the
& in a page title will continue to be encoded as %26 in the 'title'
value and is unaffected by this change.
Bug: T107289
Co-Authored-By: Ammar Abdulhamid <ammarpad@yahoo.com>
Change-Id: I1db4483db6bc52a96487fefd2c3693b4825ccbb2
|
|
|
|
|
|
|
|
|
|
|
| |
* See inline comment in WikitextContentHandler that explains
what is happening here.
* Added a new WikitextContentHandlerIntegration test to verify
this expectation (which fails without the change in this patch).
Bug: T349087
Change-Id: I072ddf89562fe79bad47d741feb5788430e05bb6
|
|
|
|
|
|
| |
deprecated in 1.38
Change-Id: I6564ff72c89ec47a680381edc298f0ffbf9bae60
|
|
|
|
| |
Change-Id: I62075b95d8b6108f1ad6cea26794ac39ac213c9a
|
|
|
|
|
|
|
|
| |
WikitextContent should be a value object that does not need access to
services. For this reason, getRedirectTargetAndText has to be moved to
WikitextContentHandler.
Change-Id: Ia6595caf7e913ef580709a4d076aa2cc9dbaacef
|
|
|
|
| |
Change-Id: I3577633670d0c2a771c690e3d6601300e1867222
|
|
|
|
|
|
|
|
|
|
|
| |
The use of Article::getRedirectHeaderHtml() has been discouraged for a
while, since WikitextContentHandler can (should) be used to insert the
redirect header. Further, since I20db09619999919bfeda997d79561d21e3bf8718
the header should be added as an extension data property instead of
directly concatenated to the HTML. Regardless, this functionality
logically should live in LinkRenderer.
Change-Id: I4d0de0e72473ae039dca420a2733bc746d8c2951
|
|
|
|
|
| |
Bug: T166010
Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
|
|
|
|
|
| |
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
|
|
|
|
|
|
|
|
|
| |
Insert the redirect handler as part of the post-processing done in
ParserOutput::getText(). This ensures that it does not corrupt
edit-mode Parsoid output.
Depends-On: Ia6e390d849830993a6b97004f099773cfd4fa54b
Change-Id: I20db09619999919bfeda997d79561d21e3bf8718
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This matches how many of the core actions are defined nowadays, and lets
ContentHandler subclasses in extensions define actions in the same way
without Phan complaining.
getActionOverrides() is consumed by ActionFactory::getAction, which
already supports these as-is. We suport ObjectFactory in core and
extensions through ActionFactory::CORE_ACTIONS and $wgActions
(via ActionFactory::getActionSpec, which also includes `array`; it also
ends with `null`, which I don’t think should be added to
getActionOverrides() because I doubt `null` is meaningful there.)
Bug: T253078
Change-Id: Ib1a6a6f6d92eaead61b4341aa6c9d3cf389c7304
Follows-Up: I4e38d80baf34d6ecdb9877bc6c8f6c4fa00cedb6
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
empty() only makes sense when the expression it checks is possibly
undefined, otherwise it's equivalent to a truthiness check with the
additional downside of suppressing errors when it's not wanted.
Replace it with simple truthiness checks, using strict comparison when
that seems to help with polymorphic variables.
These were caught by a bespoke phan plugin.
Change-Id: I52999e5286a0d9ad70b0da40b41b9f998ecb990e
|
|
|
|
|
|
|
|
|
| |
Deprecating RevisionStore::getQueryInfo() and cleaning up a lot of code
Also removing a brittle test that wasn't really testing anything.
Bug: T344971
Change-Id: Ifd690dc8f030f86e3567a717eaeb830cb6dc703b
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Deprecated since 1.35, but still used by ProofreadPage until the
listed dependency is merged.
Depends-On: I1c180521b831d8e6896679c8bfed6cb64260d40d
Change-Id: I39a1bf5b6e5d14b07be84a0a139a1abb5b289368
|
|/
|
|
|
|
|
|
|
|
| |
This class is used heavily basically everywhere, moving it to Utils
wouldn't make much sense. Also with this change, we can move
StatusValue to MediaWiki\Status as well.
Bug: T321882
Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3
Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
|
|
|
|
|
|
| |
It's deprecated; use the SlotRoleHandler directly.
Change-Id: I21ee9d220c349695a0351fd7f3f92393c7036dd1
|
|
|
|
|
|
|
|
| |
extractTextBeforeFirstHeading()
Reflects what the function is actually trying to do...
Change-Id: Ic28a3121326be210ceb97af1d3e0287dbcc7e4cf
|
|
|
|
| |
Change-Id: Ia30eca0dad454843db351f32859201bcd2710b9a
|
|
|
|
| |
Change-Id: Ica756616439a014aa85b43093aeb51ebc30f4f61
|
|
|
|
|
|
| |
This is a ParserOutput, $output is often used for OutputPage
Change-Id: I98c62140db863243e0342b9747032dc425fccc83
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Start using `class-string<ClassName>` as a type hint in a few places
where the information is really helpful. A lot of tools are able to
understand this already.
Change-Id: Ide45cae8c7875e664fab1155c6c720e515d8d811
|
|\ \ |
|
| |/
| |
| |
| |
| | |
Bug: T341754
Change-Id: I17396985d0b26516a06df17e9bd1343054521e01
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Have Article opt in to inline toggle switch display, so that random
callers of DifferenceEngine::showDiffPage() do not receive a
non-functional format selector.
Bug: T342158
Change-Id: Id4e38c2a20b5381e5f70b1244304da2895eaf8e7
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Rate limits will automatically be checked by definitelyCan(),
authorizeRead() and authorizeWrite(). The authorize methods also
increment the counter.
UserAuthority tracks which limits have already been incremented during
the current request, to avoid duplicate increments caused by code that
still calls pingLimiter directly.
DEPLOY: Risky! We SHOULD not hit rate limits more often, but we might.
Rate limit metrics should be monitored closely, see
<https://grafana.wikimedia.org/d/8oA6CWr4z/mw-rate-limiting-overview>.
Bug: T310476
Depends-On: Iebd62b0487af9172edaeae41c9b31aaf2f20fd06
Change-Id: Ic349f03b7040343815b60b0a2c84a5780326c797
|
|/
|
|
|
|
|
|
| |
The only remaining references to the Xml:: versions of those methods are
in doc comments and in HISTORY.
Bug: T341779
Change-Id: I004a925f80ae23eff2c078c95b8caa8ccf64ffd2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Follow the TODO comment in TextSlotDiffRenderer
::getTextDiffInternal() by moving the code out to three parallel
implementations, namely ExternalTextDiffer, PhpTextDiffer and
Wikidiff2TextDiffer.
* Add a container/factory class ManifoldTextDiffer to glue them
together and collate available formats.
* Move the inline legend to Wikidiff2TextDiffer. Not the toggle since
the ability to toggle depends on the available format, not the current
format.
* Update the diff cache keys so that ManifoldTextDiffer can store the
engine=>format map it used to generate the diff.
* Drop support for the second parameter to TextSlotDiffRenderer
::setEngine(), since nothing used it anymore.
* Provide a format batch API, since some engines are able to efficiently
generate multiple formats. This might be used by DifferenceEngine in
future.
Needs risky change notification for the cache key change.
Bug: T339184
Depends-On: I8a35b9b8ec1622c9a36d2496bdd24f51bc52c85f
Change-Id: I5c506e39162855aff53dd420dd8145156739059c
|
|
|
|
|
|
|
|
|
| |
Fix fixme by sending the language code to SlotDiffRenderer as an option.
Note that this is the language used for word segmentation of the
content, not the UI language.
Change-Id: I2d0a6996b02d37a3f2d8fefa851244803025bb6c
|
|
|
|
|
|
|
| |
I will address the dependencies on MW core in a followup.
Bug: T339184
Change-Id: I892364b0c9f15c9de4cfc29c683670c172d71764
|
|
|
|
|
|
|
|
| |
The idea is to make it easier for ContentHandler subclasses to reuse
TextSlotDiffRenderer by composition.
Bug: T339184
Change-Id: I963eb6500fe8b5ba92214d4744eb0aee74fc9331
|
|
|
|
|
| |
Bug: T328220
Change-Id: I0408575ee71e58d1c9e9ebedabab35bd3813f515
|
|
|
|
|
| |
Bug: T328220
Change-Id: I66be7a6dd752d6b9c254beb65f4eb5ace3c89776
|
|
|
|
|
| |
Bug: T328220
Change-Id: I3c36835fbd90acc301731e2b33ae4815cd4b0cc5
|
|
|
|
|
| |
Bug: T328220
Change-Id: Ib619ead0f397188d828e6e5dfc80ed1fa7175c7d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a legend at the top of the inline diff display, showing the
meanings of the colours of the inserted and deleted highlighting.
Also add the same text as tooltips on the highlighted elements.
The legend is added as part of a new area above the diff table
that can be modified via a new TextSlotDiffRendererTablePrefix
hook, so that extensions can add other buttons etc. there as
required.
This is a follow-up to the previous attempt, which added the
legend in DifferenceEngine::showDiff() and was called from
too many places. This patch moves it to be called in
DifferenceEngine::showDiffPage().
Bug: T324759
Change-Id: I2a3c67bcfa47313dee597e602a62073e4e298cd2
Follow-up: I6de30bf79eb5ac262285951792782b870d075e00
|
|
|
|
|
|
|
|
|
| |
The Hooks class contains deprecated functions and the whole class is
going to get removed, so remove the convenience function and inline the
code.
Bug: T335536
Change-Id: I8ef3468a64a0199996f26ef293543fcacdf2797f
|
|
|
|
|
|
| |
Follow-up to a67cad6d0fc5b6a
Change-Id: I26da1bb17f1a1855080c24a60af9c0f1ccf36d10
|
|\ |
|
| |
| |
| |
| |
| |
| | |
To the best of my knowledge.
Change-Id: I4e38d80baf34d6ecdb9877bc6c8f6c4fa00cedb6
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no way to express that Title::castFromPageIdentity(),
Title::castFromPageReference() and Title::castFromLinkTarget()
can only return null when the parameter is null. We need to add
Phan suppressions or explicit types almost everywhere that these
methods are used with parameters that are known to not be null.
Instead, introduce new methods Title::newFromPageIdentity() and
Title::newFromPageReference() (Title::newFromLinkTarget() already
exists), without the null-coalescing behavior, and use them when
the parameter is not null. This lets static analysis tools, and
humans, easily understand where nulls can't appear.
Do the same with the corresponding TitleFactory methods.
Change the obvious uses of castFrom*() to newFrom*() (if there is
a Phan suppression, a type check, or a method call on the result).
Change-Id: Ida4da75953cf3bca372a40dc88022443109ca0cb
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Unnecessary regex modifier. I agree with this inspection which flags
/s modifiers on regexes that don't use a dot.
* Property declared dynamically.
* Unused local variable. But it's acceptable for an unused local
variable to take the return value of a method under test, when it is
being tested for its side-effects. And it's acceptable for an unused
local variable to document unused list expansion elements, or the
nature of array keys in a foreach.
Change-Id: I067b5b45dd1138c00e7269b66d3d1385f202fe7f
|
|/
|
|
|
|
|
|
|
|
|
|
| |
* Triple backslash in regex should really be quadruple backslash
* Using the returned value of a void method
* Immediately overwritten array keys
* Duplicate array keys
* Foreach variable reuse
* sprintf() with too many params
* Incorrect reference usage
Change-Id: I3c649b543c9561a1614058c50f3847f663ff04df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The figcaption element looks to be many years old, but was not
previously considered a caption by the search engine. Some integration
tests have recently started failing as an element that previously
contained the thumbcaption css element is now inside a figcaption
class.
Update the code that extracts captions from the text into a separate
field to also extract the figcaption, as it has the same purpose as
thumbcaption.
Change-Id: I2a4a309e58602281d6cca65744036efb4a5ce5b5
|