Remove ArticleContentViewCustom hook, deprecated and unused

Bug: T241351
Change-Id: Ie37ed9265511e3051ea60c6898febb567d5283df
This commit is contained in:
DannyS712 2020-02-06 19:51:52 +00:00
parent 7b97196db2
commit f14fad3538
6 changed files with 3 additions and 56 deletions

View file

@ -290,7 +290,8 @@ because of Phabricator reports.
have been removed without deprecation.
* The support for old signature for ParserFactory::__construct was deprecated in
1.34 and now has been removed.
* SpecialRecentChanges::filterByCategories(), deprecated in 1.31, was removed
* SpecialRecentChanges::filterByCategories(), deprecated in 1.31, was removed.
* The `ArticleContentViewCustom` hook, deprecated in 1.32, was removed.
* …
=== Deprecations in 1.35 ===

View file

@ -81,7 +81,7 @@ Besides some functions, some hooks have also been replaced by new versions (see
* `ArticleInsertComplete` was replaced by `PageContentInsertComplete`
* `ArticleSave` was replaced by `PageContentSave`
* `ArticleSaveComplete` was replaced by `PageContentSaveComplete`
* `ArticleViewCustom` was replaced by `ArticleContentViewCustom` (also consider a custom implementation of the view action)
* `ArticleViewCustom` was replaced by `ArticleContentViewCustom`, which was later removed entirely
* `EditFilterMerged` was replaced by `EditFilterMergedContent`
* `EditPageGetDiffText` was replaced by `EditPageGetDiffContent`
* `EditPageGetPreviewText` was replaced by `EditPageGetPreviewContent`

View file

@ -606,13 +606,6 @@ $title: title of the page
$oldid: the requested revision id, or 0 for the currrent revision.
$output: a ParserOutput object
'ArticleContentViewCustom': DEPRECATED since 1.32, use ArticleRevisionViewCustom instead,
or provide an appropriate ContentHandler. Allows to output the text of the article in a
different format than wikitext.
$content: content of the page, as a Content object
$title: title of the page
$output: a ParserOutput object
'ArticleDelete': Before an article is deleted.
&$wikiPage: the WikiPage (object) being deleted
&$user: the user (object) deleting the article

View file

@ -942,11 +942,6 @@ class DifferenceEngine extends ContextSource {
) {
// Handled by extension
// NOTE: sync with hooks called in Article::view()
} elseif ( !Hooks::run( 'ArticleContentViewCustom',
[ $this->mNewContent, $this->mNewPage, $out ], '1.32' )
) {
// Handled by extension
// NOTE: sync with hooks called in Article::view()
} else {
// Normal page
if ( $this->getTitle()->equals( $this->mNewPage ) ) {

View file

@ -774,12 +774,6 @@ class Article implements Page {
// NOTE: sync with hooks called in DifferenceEngine::renderNewRevision()
// Allow extensions do their own custom view for certain pages
$outputDone = true;
} elseif ( !Hooks::run( 'ArticleContentViewCustom',
[ $this->fetchContentObject(), $this->getTitle(), $outputPage ], '1.32' )
) {
// NOTE: sync with hooks called in DifferenceEngine::renderNewRevision()
// Allow extensions do their own custom view for certain pages
$outputDone = true;
}
break;
case 4:

View file

@ -435,42 +435,6 @@ class ArticleViewTest extends MediaWikiTestCase {
$this->assertSame( 'Hook Title', $output->getPageTitle() );
}
public function testArticleContentViewCustomHook() {
$page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );
$article = new Article( $page->getTitle(), 0 );
$article->getContext()->getOutput()->setTitle( $page->getTitle() );
// use ArticleViewHeader hook to bypass the parser cache
$this->setTemporaryHook(
'ArticleViewHeader',
function ( Article $articlePage, &$outputDone, &$useParserCache ) use ( $article ) {
$useParserCache = false;
}
);
$this->setTemporaryHook(
'ArticleContentViewCustom',
function ( Content $content, Title $title, OutputPage $output ) use ( $page ) {
$this->assertSame( $page->getTitle(), $title, '$title' );
$this->assertSame( 'Test A', $content->getText(), '$content' );
$output->addHTML( 'Hook Text' );
return false;
}
);
$this->hideDeprecated(
'ArticleContentViewCustom hook (used in hook-ArticleContentViewCustom-closure)'
);
$article->view();
$output = $article->getContext()->getOutput();
$this->assertStringNotContainsString( 'Test A', $this->getHtml( $output ) );
$this->assertStringContainsString( 'Hook Text', $this->getHtml( $output ) );
}
public function testArticleRevisionViewCustomHook() {
$page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );