# If this is a MediaWiki:x message, then load the messages
# and return the message value for x.
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
- # If this is a system message, get the default text.
- list( $message, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) );
- $text = wfMsgGetKey( $message, false, $lang, false );
-
- if ( wfEmptyMsg( $message, $text ) )
+ $text = $this->getDefaultMessageText();
+ if ( $text === false ) {
$text = '';
+ }
} else {
$text = wfMsgExt( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon', 'parsemag' );
}
}
}
+ /**
+ * Get the default message text or false if the message doesn't exist
+ *
+ * @return String or false
+ */
+ public function getDefaultMessageText() {
+ global $wgContLang;
+
+ if ( $this->mTitle->getNamespace() != NS_MEDIAWIKI ) { // Just in case
+ return false;
+ }
+
+ list( $name, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) );
+ $message = wfMessage( $name )->inLanguage( $lang )->useDatabase( false );
+
+ if ( $message->exists() ) {
+ return $message->plain();
+ } else {
+ return false;
+ }
+ }
+
/**
* Get the text of the current revision. No side-effects...
*
wfMsgNoTrans( 'missingarticle-rev', $oldid ) );
} elseif ( $this->mTitle->getNamespace() === NS_MEDIAWIKI ) {
// Use the default message text
- $text = $this->getContent();
+ $text = $this->getDefaultMessageText();
} else {
$createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser );
$editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
if ( !$this->mTitle->exists() ) {
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
# If this is a system message, get the default text.
- list( $message, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) );
- $text = wfMsgGetKey( $message, false, $lang, false );
- if( wfEmptyMsg( $message, $text ) )
+ $text = $this->mArticle->getDefaultMessageText();
+ if( $text === false ) {
$text = $this->getPreloadedText( $preload );
+ }
} else {
# If requested, preload some text.
$text = $this->getPreloadedText( $preload );