Page MenuHomePhabricator

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

Description

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;

Steps:

  • 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()

https://gerrit.wikimedia.org/r/691704

Change 691704 merged by jenkins-bot:

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

https://gerrit.wikimedia.org/r/691704

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)