Page MenuHomePhabricator

Deprecate and remove ContentHandler::getContentText() and $wgContentHandlerTextFallback
Open, MediumPublic


ContentHandler::getContentText() was introduced as a migration helper when moving from text-only content to Content objects in 2011. It's mostly unused and pointless now, and should be replaced by:

$text = ( $content instanceof TextContent ) ? $content->getText() : null;


  • Soft-deprecate ContentHandler::getContentText()
  • Remove usages of ContentHandler::getContentText() in core
  • Remove usages of ContentHandler::getContentText() in extensions
  • Hard-deprecate ContentHandler::getContentText() (after usage has been removed in all code maintained by WMF)
  • Remove method after it has been hard deprecated in one release (so not before 1.36 has been branched)

Event Timeline

Change 691704 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] Soft deprecate ContentHandler::getContentText()

Change 691704 merged by jenkins-bot:

[mediawiki/core@master] Soft deprecate ContentHandler::getContentText()

I uploaded some patches for the removal of the usage, they can be found here:

Mentioned in SAL (#wikimedia-operations) [2021-05-18T18:26:08Z] <urbanecm@deploy1002> Synchronized w/robots.php: 8224e53f6da61bf037bb3e3ad1cf367bf9b5a588: robots.php: avoid using ContentHandler::getContentText() (T268041) (duration: 01m 04s)