- // For non-existent pages, Article::getContent()
- // returns an interface message rather than ''
- // We do want getContent()'s behavior for non-existent
- // MediaWiki: pages, though
- if ( $articleObj->getID() == 0 && $titleObj->getNamespace() != NS_MEDIAWIKI ) {
- $content = '';
- } else {
- $content = $articleObj->getContent();
+ $content = $pageObj->getContent();
+
+ if ( !( $content instanceof TextContent ) ) {
+ // @todo: ContentHandler should have an isFlat() method or some such
+ // @todo: XXX: or perhaps there should be Content::append(), Content::prepend() and Content::supportsConcatenation()
+ $mode = $contentHandler->getModelID();
+ $this->dieUsage( "Can't append to pages using content model $mode", 'appendnotsupported' );
+ }
+
+ if ( !$content ) {
+ # If this is a MediaWiki:x message, then load the messages
+ # and return the message value for x.
+ if ( $titleObj->getNamespace() == NS_MEDIAWIKI ) {
+ $text = $titleObj->getDefaultMessageText();
+ if ( $text === false ) {
+ $text = '';
+ }
+
+ $content = ContentHandler::makeContent( $text, $this->getTitle() );
+ }