Remove hard-deprecated Article::getContentObject

Change-Id: I31eb3cc5574391c9e35d57ac5b2fc83e12f5a1bc
This commit is contained in:
Petr Pchelko 2021-08-10 21:36:14 -07:00
parent 0f76e5ad26
commit c563798b51
2 changed files with 1 additions and 58 deletions

View file

@ -398,6 +398,7 @@ because of Phabricator reports.
languages where nouns must be capitalized. This class is no longer added to languages where nouns must be capitalized. This class is no longer added to
the body tag and must be provided by skins. the body tag and must be provided by skins.
* The SkinTemplateOutputPageBeforeExec hook, deprecated since 1.35, was removed. * The SkinTemplateOutputPageBeforeExec hook, deprecated since 1.35, was removed.
* Article::getContentObject, deprecated since 1.32, was removed.
* … * …
=== Deprecations in 1.37 === === Deprecations in 1.37 ===

View file

@ -246,64 +246,6 @@ class Article implements Page {
$this->mPage->clear(); $this->mPage->clear();
} }
/**
* Returns a Content object representing the pages effective display content,
* not necessarily the revision's content!
*
* Note that getContent does not follow redirects anymore.
* If you need to fetch redirectable content easily, try
* the shortcut in WikiPage::getRedirectTarget()
*
* This function has side effects! Do not use this function if you
* only want the real revision text if any.
*
* @deprecated since 1.32, use fetchRevisionRecord() instead. Hard since 1.36.
*
* @return Content|null
*
* @since 1.21
*/
protected function getContentObject() {
wfDeprecated( __METHOD__, '1.32' );
$content = null;
if ( $this->mPage->getId() === 0 ) {
$content = $this->getSubstituteContent();
} else {
$revision = $this->fetchRevisionRecord();
if ( $revision ) {
$content = $revision->getContent(
SlotRecord::MAIN,
RevisionRecord::FOR_THIS_USER,
$this->getContext()->getUser()
);
}
}
return $content;
}
/**
* Returns Content object to use when the page does not exist.
*
* @return Content
*/
private function getSubstituteContent() {
# If this is a MediaWiki:x message, then load the messages
# and return the message value for x.
if ( $this->getTitle()->getNamespace() === NS_MEDIAWIKI ) {
$text = $this->getTitle()->getDefaultMessageText();
if ( $text === false ) {
$text = '';
}
$content = ContentHandler::makeContent( $text, $this->getTitle() );
} else {
$message = $this->getContext()->getUser()->isRegistered() ? 'noarticletext' : 'noarticletextanon';
$content = new MessageContent( $message, null );
}
return $content;
}
/** /**
* @see getOldIDFromRequest() * @see getOldIDFromRequest()
* @see getRevIdFetched() * @see getRevIdFetched()