Remove ArticleContentViewCustom hook, deprecated and unused
Bug: T241351 Change-Id: Ie37ed9265511e3051ea60c6898febb567d5283df
This commit is contained in:
parent
7b97196db2
commit
f14fad3538
6 changed files with 3 additions and 56 deletions
|
|
@ -290,7 +290,8 @@ because of Phabricator reports.
|
||||||
have been removed without deprecation.
|
have been removed without deprecation.
|
||||||
* The support for old signature for ParserFactory::__construct was deprecated in
|
* The support for old signature for ParserFactory::__construct was deprecated in
|
||||||
1.34 and now has been removed.
|
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 ===
|
=== Deprecations in 1.35 ===
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ Besides some functions, some hooks have also been replaced by new versions (see
|
||||||
* `ArticleInsertComplete` was replaced by `PageContentInsertComplete`
|
* `ArticleInsertComplete` was replaced by `PageContentInsertComplete`
|
||||||
* `ArticleSave` was replaced by `PageContentSave`
|
* `ArticleSave` was replaced by `PageContentSave`
|
||||||
* `ArticleSaveComplete` was replaced by `PageContentSaveComplete`
|
* `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`
|
* `EditFilterMerged` was replaced by `EditFilterMergedContent`
|
||||||
* `EditPageGetDiffText` was replaced by `EditPageGetDiffContent`
|
* `EditPageGetDiffText` was replaced by `EditPageGetDiffContent`
|
||||||
* `EditPageGetPreviewText` was replaced by `EditPageGetPreviewContent`
|
* `EditPageGetPreviewText` was replaced by `EditPageGetPreviewContent`
|
||||||
|
|
|
||||||
|
|
@ -606,13 +606,6 @@ $title: title of the page
|
||||||
$oldid: the requested revision id, or 0 for the currrent revision.
|
$oldid: the requested revision id, or 0 for the currrent revision.
|
||||||
$output: a ParserOutput object
|
$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.
|
'ArticleDelete': Before an article is deleted.
|
||||||
&$wikiPage: the WikiPage (object) being deleted
|
&$wikiPage: the WikiPage (object) being deleted
|
||||||
&$user: the user (object) deleting the article
|
&$user: the user (object) deleting the article
|
||||||
|
|
|
||||||
|
|
@ -942,11 +942,6 @@ class DifferenceEngine extends ContextSource {
|
||||||
) {
|
) {
|
||||||
// Handled by extension
|
// Handled by extension
|
||||||
// NOTE: sync with hooks called in Article::view()
|
// 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 {
|
} else {
|
||||||
// Normal page
|
// Normal page
|
||||||
if ( $this->getTitle()->equals( $this->mNewPage ) ) {
|
if ( $this->getTitle()->equals( $this->mNewPage ) ) {
|
||||||
|
|
|
||||||
|
|
@ -774,12 +774,6 @@ class Article implements Page {
|
||||||
// NOTE: sync with hooks called in DifferenceEngine::renderNewRevision()
|
// NOTE: sync with hooks called in DifferenceEngine::renderNewRevision()
|
||||||
// Allow extensions do their own custom view for certain pages
|
// Allow extensions do their own custom view for certain pages
|
||||||
$outputDone = true;
|
$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;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
|
|
||||||
|
|
@ -435,42 +435,6 @@ class ArticleViewTest extends MediaWikiTestCase {
|
||||||
$this->assertSame( 'Hook Title', $output->getPageTitle() );
|
$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() {
|
public function testArticleRevisionViewCustomHook() {
|
||||||
$page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );
|
$page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue