- Allows to reuse the RevisionRecord and not reloading in
WikiPage::getParserOutput from the RevisionStore
- Allows to pass ParserOutputAccess::OPT_NO_AUDIENCE_CHECK to get a
ParserOutput also for revision deleted content, where a check
against RevisionRecord::FOR_PUBLIC would reject the content
- Allows to show error message when render does not work
Bug: T212316
Change-Id: Id3c2de3e5cf796f5a9b213bd7bd94c9291014eb5
getTablePrefix() is used to show the inline legend and inline switcher.
It is not yet part of a released stable interface.
Theoretically there may be multiple text slots on a page, and we don't
want multiple inline legends. There was already a fragment assembly
system, for the benefit of hook handlers, so move that up to the page
level, so that it can also deduplicate prefix fragments coming from
each slot.
Add tests.
Bug: T324759
Change-Id: I9baa5c24128c63bc318ba13e83a024843f4ab15e
Add a switch that allows toggling between inline and two-column format
when Wikidiff2 is installed.
Inline toggle should also support no-JS toggling
The legend should toggle when switching from table to inline after the
first load.
Introduced a temporary feature flag to show this inline toggle so that
we can merge and easily continue the improvements. It will be removed
when ready for production.
Bug: T336712
Bug: T330229
Change-Id: Ie6a48e495f2bb299d8b984e7c40363d534c7915b
When the old and new content object for a slot cannot be compared,
show an error message for that slot only, instead of throwing an
exception.
Bug: T214217
Change-Id: I6e982df358f85ca78f0448b3a93ded3f40676310
When the old and new revisions have identical content in a given slot,
do not include the relevant SlotDiffRenderer in the return value of
DifferenceEngine::getSlotDiffRenderers(), so that the relevant table
prefixes and modules will be omitted.
Also:
* In TextSlotDiffRenderer::getTextDiff(), return an empty string when
the inputs are equal, instead of invoking the diff engine. Previously,
the inline format would produce a <tr> element in this case, causing
the diff-empty message to be omitted.
* Clarify the doc comment up the stack, indicating SlotDiffRenderer may
return zero <tr> tags, it doesn't have to be one or more.
* Fix the documented return type of getSlotContents() so that @var is
not needed in the caller.
* Don't convert the return value of SlotDiffRenderer::getDiff() to
boolean. It's always a string so compare it to the empty string.
Note that the cache key for inline empty diffs will change, because
TextSlotDiffRenderer::getExtraCacheKeys() is not called anymore for
empty diffs.
Bug: T338670
Change-Id: I0774ba0b159ac43ec214403cf2d06740f6d067cd
Also, HTML-escape the cache key in the output. In the current
implementation it is HTML-safe, but it could change.
Bug: T228761
Change-Id: I23406266fef4906cdf0a281f7058b66b30680f0d
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
To avoid showing it on other content types, such
as PageSlotDiffRenderer in ProofreadPage.
Bug: T336481
Change-Id: Ibe453fc9e8f4eea5de9c66e1446286174eb3ad17
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 DifferenceEngineBeforeDiffTable
hook, so that extensions can add other buttons etc. there as
required.
Bug: T324759
Change-Id: I6de30bf79eb5ac262285951792782b870d075e00
This duplicates what's done in resources/src/mediawiki.action/mediawiki.action.edit.preview.js
for easier searching.
Change-Id: Iecac1b242f461d3e10cf2b9ad8e1c0d950ef9dfa
- No linking when the user cannot see the suppressed revision
- Double-strike the timestamp (b6f148b)
Bug: T325450
Change-Id: If94e9655d72e59a2b9d5147c5c2338e98f0ad163
It misrepresents the users contribution to show empty text for a
revision when in fact the revision contained some text which we later
lost.
Also, errors from SqlBlobStore::fetchBlobs() did not stop a cache entry
from being written, so a subsequent cache hit would show the bad
revision as empty.
So, in Storage:
* Add BadBlobException, which is thrown by the Storage layer to
indicate that a revision is marked as bad.
* Have SqlBlobStore::getBlobStore() return an error for bad blobs
instead of an empty string.
* Duplicate the check for flags=error into SqlBlobStore::expandBlob().
This avoids an unnecessary cache fetch, and avoids making
decompressData() throw on error, which would be a b/c break.
* In SqlBlobStore::getBlob(), suppress the cache when there was an
error.
In Revision:
* Add BadRevisionException, to wrap BadBlobException in the Revision
layer.
* Return null from RevisionRecord::getContent() on a broader set of
errors. Make it mostly non-throwing.
* Add RevisionRecord::getContentOrThrow() which returns a non-nullable
Content.
* Note that SlotRecord::getContent() returns a non-nullable Content so
now throws in more cases.
In the UI:
* In Article::view(), catch the exception and show an error message.
* In DifferenceEngine, catch the exception and make a suitable error
message available via getRevisionLoadErrors(). In the diff page, show
the error message in a box.
* In ApiComparePages and the legacy rvdiffto, show a warning.
* In RawAction, show a 404 by analogy with other error cases.
* In EditPage, there was already handling for $content=null with an
appropriate error message (missing-revision-content). But having
$this->textbox1 = null caused PHP 8.1 deprecation warnings, so I fixed
that.
* In EditPage undo, there was already handling for null content, but I
improved the error message: "does not exist or was deleted" seems more
appropriate than "conflicting intermediate edits".
Change-Id: Idd1278d6d756ef37d64addb7b5f3be30747ea603
In 81f69c2, I have only removed the callers. The method is
now dead code and should have been removed as well.
Change-Id: I556ed5398435f4d3a5f400e07e4819dd16e0df06
When setting causeAgent for jobs, be specific.
When creating parserOptions, call setRenderReason.
This allows us to capture statistics on what actions cause jobs,
renders, and cache writes.
Change-Id: Iaef64beadce1489bebb6bb00855c3ba6013a29d8
Mainly, document some parameters as non-empty-array so that phan knows
the list of arguments won't be empty when unpacking.
In EditPage, account for hooks potentially unsetting the copyright
notice.
Also rewrite some code in LogPager, so it's hopefully easier for phan to
understand what's going on.
Change-Id: Ic0638571554424098d0743db32dd46723a08e103
We rely on the default settings for `skin` and `injectTOC` set by
OutputPage::addParserOutputText(), and so no longer need to explicitly
initialize these from the skin options.
Bug: T317333
Depends-On: Ica30569efbb5730eff5b807e8fc34beb2e13e74f
Change-Id: I5b8ecd1abf87e66bb75d7c26790f9e7c1b3a6da3
Previously, OutputPage::isRevisionCurrent() would check a replica
database, potentially different from the database used to fetch the
revision being displayed, according to OutputPage::getRevisionId().
Now the data for both functions is provided in the same way.
Bug: T314684
Change-Id: I266d643d1eed931df346889f43d72d42e5f4a3ba
This edition brought to you by:
grep -ERIn $(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | tr
"\n" '|' | sed 's/|$/\n/') includes/
I only corrected a fraction of the results provided by that command. I'm
submitting the partial patch now so it doesn't bitrot.
Bug: T305805
Change-Id: If1918c0b3d88cdf90403921e4310740e206d6962
Make phan stricter about null types by setting null_casts_as_any_type to
false (the default in mediawiki-phan-config)
Remaining false positive issues are suppressed.
The suppression and the setting change can only be done together
Bug: T242536
Bug: T301991
Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01