Use ArticleAfterFetchContentObject hook.

No longer use deprecated ArticleAfterFetchContent hook. The new hook
requires MediaWiki 1.21 or later.
This commit is contained in:
Daniel Kraus
2014-06-08 22:52:36 +02:00
parent fc13f88717
commit e5008b9997

View File

@ -38,7 +38,8 @@
$wgHooks['PageContentSave'][] = 'LinkTitles::onPageContentSave'; $wgHooks['PageContentSave'][] = 'LinkTitles::onPageContentSave';
}; };
if ( $wgLinkTitlesParseOnRender ) { if ( $wgLinkTitlesParseOnRender ) {
$wgHooks['ArticleAfterFetchContent'][] = 'LinkTitles::onArticleAfterFetchContent'; $wgHooks['ArticleAfterFetchContentObject'][] =
'LinkTitles::onArticleAfterFetchContentObject';
}; };
$wgHooks['ParserBeforeTidy'][] = 'LinkTitles::removeMagicWord'; $wgHooks['ParserBeforeTidy'][] = 'LinkTitles::removeMagicWord';
} }
@ -56,9 +57,9 @@
/// Event handler that is hooked to the ArticleAfterFetchContent event. /// Event handler that is hooked to the ArticleAfterFetchContent event.
/// @param $article Article object /// @param $article Article object
/// @param $content Content object that holds the article content /// @param $content Content object that holds the article content
public static function onArticleAfterFetchContent( &$article, &$content ) { public static function onArticleAfterFetchContentObject( &$article, &$content ) {
// The ArticleAfterFetchContent event is triggered whenever page content // The ArticleAfterFetchContentObject event is triggered whenever page
// is retrieved from the database, i.e. also for editing etc. // content is retrieved from the database, i.e. also for editing etc.
// Therefore we access the global $action variabl to only parse the // Therefore we access the global $action variabl to only parse the
// content when the page is viewed. // content when the page is viewed.
global $action; global $action;