wiki.techinc.nl/includes/diff
Tim Starling 540bddfb1f When content is marked bad, show an error, don't pretend it is empty
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
2022-12-05 22:03:45 +00:00
..
Hook
ArrayDiffFormatter.php
ComplexityException.php
Diff.php
DiffEngine.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
DifferenceEngine.php When content is marked bad, show an error, don't pretend it is empty 2022-12-05 22:03:45 +00:00
DifferenceEngineSlotDiffRenderer.php build: Update mediawiki/mediawiki-phan-config to 0.12.0 2022-10-08 15:45:42 +02:00
DiffFormatter.php
DiffOp.php
DiffOpAdd.php
DiffOpChange.php
DiffOpCopy.php
DiffOpDelete.php
RangeDifference.php
SlotDiffRenderer.php
TableDiffFormatter.php
TextSlotDiffRenderer.php
UnifiedDiffFormatter.php
UnsupportedSlotDiffRenderer.php
WordAccumulator.php WordAccumulator: use htmlspecialchars with ENT_NOQUOTES 2022-11-02 12:38:02 +11:00
WordLevelDiff.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00