From 14628fe5920bf997fdffa82f953c1b84bd7f0c49 Mon Sep 17 00:00:00 2001 From: daniel Date: Sat, 9 Jun 2012 13:31:11 +0200 Subject: [PATCH] use getWikitextForInclusion to get message text from MediaWiki namespace --- includes/Content.php | 3 ++- includes/WikiPage.php | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/includes/Content.php b/includes/Content.php index a95721ef97..ec81b2ffe7 100644 --- a/includes/Content.php +++ b/includes/Content.php @@ -25,7 +25,8 @@ interface Content { * includable in a wikitext page. * * @TODO: allow native handling, bypassing wikitext representation, like for includable special pages. - * @TODO: use in parser, etc! + * @TODO: allow transclusion into other content models than Wikitext! + * @TODO: used in WikiPage and MessageCache to get message text. Not so nice. What should we use instead?! */ public function getWikitextForTransclusion( ); diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 7d183cf359..20d61065f4 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1164,8 +1164,16 @@ class WikiPage extends Page { } if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { + //@todo: move this logic to MessageCache + if ( $this->mTitle->exists() ) { - $text = ContentHandler::getContentText( $this->getContent() ); #XXX: get native data directly? + // NOTE: use transclusion text for messages. + // This is consistent with MessageCache::getMsgFromNamespace() + + $content = $this->getContent(); + $text = $content === null ? null : $content->getWikitextForTransclusion(); + + if ( $text === null ) $text = false; } else { $text = false; } -- 2.20.1