aboutsummaryrefslogtreecommitdiffstats
path: root/includes/specials
diff options
context:
space:
mode:
authorTim Starling <tstarling@wikimedia.org>2022-11-29 14:38:29 +1100
committerTim Starling <tstarling@wikimedia.org>2022-12-05 22:03:45 +0000
commit540bddfb1fb3ec7172ba556a507b5ceffda72754 (patch)
tree8bdd07d2b7065012d90752c4795b9b21e350f06e /includes/specials
parent6c175865f40982aee9c6657280d097ece81d69f6 (diff)
downloadmediawikicore-540bddfb1fb3ec7172ba556a507b5ceffda72754.tar.gz
mediawikicore-540bddfb1fb3ec7172ba556a507b5ceffda72754.zip
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
Diffstat (limited to 'includes/specials')
0 files changed, 0 insertions, 0 deletions