use getWikitextForInclusion to get message text from MediaWiki namespace
authordaniel <daniel.kinzler@wikimedia.de>
Sat, 9 Jun 2012 11:31:11 +0000 (13:31 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Sat, 9 Jun 2012 11:34:13 +0000 (13:34 +0200)
includes/Content.php
includes/WikiPage.php

index a95721e..ec81b2f 100644 (file)
@@ -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( );
 
index 7d183cf..20d6106 100644 (file)
@@ -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;
                        }