wiki.techinc.nl/includes
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
..
actions Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
api When content is marked bad, show an error, don't pretend it is empty 2022-12-05 22:03:45 +00:00
auth auth: Migrate some calls of $db->select() to SelectQueryBuilder 2022-11-25 18:51:36 +01:00
block Deprecate global-blocks-specific methods and hook 2022-11-28 15:33:44 +00:00
cache Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
changes Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
changetags Various doc fixes about false and null on method arguments/return types 2022-11-03 18:55:47 +01:00
collation Remove Collation::singleton()/factory() 2022-09-30 19:47:34 +00:00
CommentFormatter Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
composer
config Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
content Merge "WikiTextStructure::getDefaultSort should return null, not false" 2022-11-22 10:39:06 +00:00
context Merge "Remove references to Suhosin and its INI settings" 2022-11-10 08:36:01 +00:00
dao
db Revert "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-27 13:14:16 +00:00
debug Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
deferred Drop unused deprecated hooks 2022-11-28 13:15:19 +00:00
diff When content is marked bad, show an error, don't pretend it is empty 2022-12-05 22:03:45 +00:00
edit edit: Fix casing of ParsoidRenderID in a doc comment 2022-12-05 02:04:35 -05:00
editpage Various doc fixes about false on method arguments/return types 2022-11-10 19:23:46 +00:00
exception Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
export Clean up PHP 7.1 reference hacks 2022-11-16 12:42:42 +11:00
externalstore ExternalStoreFactory: fix total failure when $wgAutoloadAttemptLowercase = false 2022-11-21 22:07:17 +00:00
Feed Feed: Use DerivativeContext and not clone main RequestContext 2022-11-15 21:13:37 +01:00
filebackend Merge "Use short array destructuring instead of list()" 2022-10-21 11:11:06 +00:00
filerepo Merge "Make use of the new PageUpdateStatus" 2022-12-01 10:45:32 +00:00
gallery Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
historyblob HistoryBlob serialization stability 2022-11-21 16:54:28 +11:00
Hook Merge "HookRunner - Change PreferencesGetLayoutHook params" 2022-11-22 01:24:36 +00:00
HookContainer Drop more unused hard deprecated hooks 2022-12-01 03:36:48 +01:00
htmlform Remove unused variable from unpacking arrays 2022-11-22 23:21:08 +00:00
http Various doc fixes about false on method arguments/return types 2022-11-10 19:23:46 +00:00
import Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
installer Localisation updates from https://translatewiki.net. 2022-12-05 08:14:57 +01:00
interwiki Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
jobqueue Document exceptions 2022-11-28 17:04:25 +00:00
json
language Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
languages Add Khakas language (kjh) 2022-11-29 11:16:34 +02:00
libs WANObjectCache: Fix string interpolation 2022-11-30 23:17:17 +01:00
linkeddata Revert "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-27 13:14:16 +00:00
linker Linker: Avoid querying null value if link target is not found 2022-11-02 16:54:12 +01:00
logging Merge "Prefill page/pattern/tagfilter/offender in form for Special:Log" 2022-11-23 11:35:25 +00:00
mail Merge "mail: Increase readability of conditions" 2022-12-02 09:24:55 +00:00
Maintenance Respond to some messages from Phan on PHP 8.1 2022-11-03 16:25:43 +11:00
media Language: Handle ronna and quetta 2022-11-22 10:06:51 +00:00
Message
Navigation PagerNavigationBuilder: Document that nulls in setLinkQuery() etc. are allowed 2022-11-02 23:56:35 +00:00
objectcache Merge "objectcache: suppress TransactionProfiler in occasionallyGarbageCollect()" 2022-11-17 16:12:28 +00:00
page When content is marked bad, show an error, don't pretend it is empty 2022-12-05 22:03:45 +00:00
pager Merge "pager: Remove unused AlphabeticPager::getOrderTypeMessages() support" 2022-11-02 18:58:48 +00:00
ParamValidator/TypeDef Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
parser Merge "[Re-apply] ParsoidHandler: use HtmlOutputRendererHelper in wt2html" 2022-12-05 19:21:23 +00:00
password password: Update Argon2Password for PHP 7.4 minimum 2022-11-22 22:47:42 +00:00
Permissions Revert "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-27 13:14:16 +00:00
poolcounter Use the null coalescing assignment operator 2022-10-21 13:26:49 +11:00
preferences Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
profiler profiler: Drop support for Tideways 4.x in ProfilerXhprof 2022-11-28 06:20:45 +00:00
rcfeed
registration Various doc fixes about false on method arguments/return types 2022-11-10 19:23:46 +00:00
Request Reorg: Move HeaderCallback to Request directory 2022-11-08 10:53:27 +01:00
ResourceLoader Merge "resourceloader: Modern ES6 code should be forced to target mobile" 2022-12-05 19:43:34 +00:00
Rest Merge "[Fix] ParsoidHandler: use HtmlOutputRendererHelper in wt2html" 2022-12-05 19:21:31 +00:00
Revision When content is marked bad, show an error, don't pretend it is empty 2022-12-05 22:03:45 +00:00
revisiondelete Remove RevDelList::reloadFromMaster 2022-11-28 21:25:39 +00:00
revisionlist
search Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
session Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
Settings Merge "Settings: Introduce SettingsBuilder::getInstance to avoid $wgSettings" 2022-11-17 20:22:12 +00:00
shell Include core PSR-4 classes in the generated classmap 2022-11-08 12:13:32 +01:00
site Merge "Various doc fixes about false on method arguments/return types" 2022-11-17 14:53:24 +00:00
skins Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
sparql
specialpage Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
specials Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
Storage When content is marked bad, show an error, don't pretend it is empty 2022-12-05 22:03:45 +00:00
StubObject Reorg: Move StubObject classes in includes to its own directory 2022-10-25 16:04:48 -04:00
templates
tidy Remove deprecated code from tidy drivers 2022-11-28 18:05:34 +01:00
title Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
upload Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
user Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
utils Miscellaneous PHP version related cleanups 2022-11-21 10:11:53 +11:00
watcheditem Merge "WatchedItemStore: Use primary key for update on watchlist" 2022-11-26 10:07:17 +00:00
watchlist
widget Allow setting min/max on DateInputWidget 2022-10-21 17:51:59 +00:00
xml Respond to some messages from Phan on PHP 8.1 2022-11-03 16:25:43 +11:00
.htaccess
ActorMigration.php Soft-deprecate the remainder of ActorMigration 2022-09-29 14:39:22 +02:00
ActorMigrationBase.php Use short array destructuring instead of list() 2022-10-21 15:33:37 +11:00
AutoLoader.php AutoLoader: Drop support for $wgAutoloadAttemptLowercase 2022-12-04 02:38:57 -05:00
BadFileLookup.php
BootstrapHelperFunctions.php
CategoriesRdf.php
Category.php Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
CategoryViewer.php
CommentStore.php CommentStore: Use SelectQueryBuilder 2022-11-21 18:53:32 +01:00
CommentStoreComment.php
config-merge-strategies.php Skins: Config flag controls contributions link 2022-11-08 10:33:39 +01:00
config-schema.php AutoLoader: Drop support for $wgAutoloadAttemptLowercase 2022-12-04 02:38:57 -05:00
config-vars.php AutoLoader: Drop support for $wgAutoloadAttemptLowercase 2022-12-04 02:38:57 -05:00
ConfiguredReadOnlyMode.php
ContentSecurityPolicy.php Replace various array type hints with more specific string[] 2022-09-27 09:24:22 +02:00
DefaultSettings.php
Defines.php
DevelopmentSettings.php DevelopmentSettings: Enable Vue development mode 2022-11-17 12:00:23 +00:00
DummyLinker.php Remove deprecated Linker::normaliseSpecialPage 2022-10-24 20:04:20 +00:00
EditPage.php When content is marked bad, show an error, don't pretend it is empty 2022-12-05 22:03:45 +00:00
Emptiable.php
EventRelayerGroup.php
ExtensionInfo.php Various doc fixes about false on method arguments/return types 2022-11-10 19:23:46 +00:00
FauxResponse.php
FileDeleteForm.php
FormOptions.php Document exceptions 2022-11-28 17:04:25 +00:00
GitInfo.php Various doc fixes about false on method arguments/return types 2022-11-10 19:23:46 +00:00
GlobalFunctions.php Merge "Replace some in_array( array_keys() ) with simple isset()" 2022-11-18 21:21:24 +00:00
Hooks.php
Html.php
HtmlHelper.php
Linker.php Remove deprecated Linker::normaliseSpecialPage 2022-10-24 20:04:20 +00:00
LinkFilter.php Various doc fixes about false on method arguments/return types 2022-11-10 19:23:46 +00:00
ListToggle.php
MagicWord.php
MagicWordArray.php Merge "Hard-deprecate MagicWordArray::getVariableRegex" 2022-11-21 14:06:24 +00:00
MagicWordFactory.php
MainConfigNames.php AutoLoader: Drop support for $wgAutoloadAttemptLowercase 2022-12-04 02:38:57 -05:00
MainConfigNames.template
MainConfigSchema.php AutoLoader: Drop support for $wgAutoloadAttemptLowercase 2022-12-04 02:38:57 -05:00
MediaWiki.php Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
MediaWikiServices.php Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
MediaWikiVersionFetcher.php
MergeHistory.php Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
MovePage.php Fix casing of class and function name usages 2022-12-04 19:09:30 +00:00
MWTimestamp.php Remove deprecated MWTimestamp::getHumanTimestamp 2022-11-03 17:00:39 +00:00
NoLocalSettings.php
OutputHandler.php Revert "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-27 13:14:16 +00:00
OutputPage.php resourceloader: Raise severity of targets violation to WARNING 2022-12-03 16:43:00 +00:00
PageProps.php Reorg: Move Title-related classes to title/ 2022-11-26 09:30:32 +00:00
PHPVersionCheck.php .phan/config.php: Update minimum_target_php_version 2022-10-03 15:46:40 +01:00
Pingback.php pingback: Update schema revision 2022-10-12 13:11:04 +00:00
ProtectionForm.php Revert "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-27 13:14:16 +00:00
ProxyLookup.php
RawMessage.php
ReadOnlyMode.php
ServiceWiring.php HtmlOutputRendererHelper: add more convenient setters 2022-11-28 12:07:17 +01:00
Setup.php Merge "Miscellaneous PHP version related cleanups" 2022-11-20 23:59:47 +00:00
SetupDynamicConfig.php
SiteConfiguration.php
SiteStats.php SiteStats: Use the null coalescing assignment operator 2022-10-21 16:48:41 -04:00
SiteStatsInit.php SiteStatsInit: Migrate Database::select usages to SelectQueryBuilder 2022-09-30 17:48:10 +02:00
Status.php Various doc fixes about false on method arguments/return types 2022-11-10 19:23:46 +00:00
StreamFile.php
TemplateParser.php
TemplatesOnThisPageFormatter.php
TrackingCategories.php
WebRequest.php Reorg: Move some of request related classes to MediaWiki/Request 2022-10-28 10:15:31 +00:00
WebResponse.php Reorg: Move HeaderCallback to Request directory 2022-11-08 10:53:27 +01:00
WebStart.php
WikiMap.php Various doc fixes about false and null on method arguments/return types 2022-11-03 18:55:47 +01:00
WikiReference.php