# If this is a MediaWiki:x message, then load the messages
# and return the message value for x.
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
- $text = $this->getDefaultMessageText();
+ $text = $this->mTitle->getDefaultMessageText();
if ( $text === false ) {
$text = '';
}
}
}
- /**
- * 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->getDefaultMessageText();
+ $text = $this->mTitle->getDefaultMessageText();
} else {
$createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser );
$editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
// This doesn't quite make sense; the user is asking for
// information about the _page_, not the message... -- RC
- $wgOut->addHTML( htmlspecialchars( wfMsgWeirdKey( $this->mTitle->getText() ) ) );
+ $wgOut->addHTML( htmlspecialchars( $this->mTitle->getDefaultMessageText() ) );
} else {
$msg = $wgUser->isLoggedIn()
? 'noarticletext'
if ( !$this->mTitle->exists() ) {
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
# If this is a system message, get the default text.
- $text = $this->mArticle->getDefaultMessageText();
+ $text = $this->mTitle->getDefaultMessageText();
if( $text === false ) {
$text = $this->getPreloadedText( $preload );
}
/**
* This function provides the message source for messages to be edited which are *not* stored in the database.
- * @param $key String:
+ *
+ * @deprecated in 1.18; use wfMessage()
+ * @param $key String
*/
function wfMsgWeirdKey( $key ) {
$source = wfMsgGetKey( $key, false, true, false );
// selflink, possibly with fragment
return $this->mDbkeyform == '';
case NS_MEDIAWIKI:
- // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes
- // the full l10n of that language to be loaded. That takes much memory and
- // isn't needed. So we strip the language part away.
- list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
// known system message
- return (bool)wfMsgWeirdKey( $basename );
+ return $this->getDefaultMessageText() !== false;
default:
return false;
}
if ( $this->mNamespace == NS_MEDIAWIKI ) {
// If the page doesn't exist but is a known system message, default
// message content will be displayed, same for language subpages
- // Also, if the page is form Mediawiki:message/lang, calling wfMsgWeirdKey
- // causes the full l10n of that language to be loaded. That takes much
- // memory and isn't needed. So we strip the language part away.
- list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
- return (bool)wfMsgWeirdKey( $basename );
+ return $this->getDefaultMessageText() !== false;
}
return false;
}
+ /**
+ * Get the default message text or false if the message doesn't exist
+ *
+ * @return String or false
+ */
+ public function getDefaultMessageText() {
+ global $wgContLang;
+
+ if ( $this->getNamespace() != NS_MEDIAWIKI ) { // Just in case
+ return false;
+ }
+
+ list( $name, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->getText() ) );
+ $message = wfMessage( $name )->inLanguage( $lang )->useDatabase( false );
+
+ if ( $message->exists() ) {
+ return $message->plain();
+ } else {
+ return false;
+ }
+ }
+
/**
* Is this in a namespace that allows actual pages?
*
}
}
- $title = Title::newFromText( wfMsgWeirdKey( "mainpage/$lang" ) );
+ $title = Title::newFromText( wfMessage( 'mainpage' )->inLanguage( $lang )->useDatabase( false )->plain() );
$this->output( "Writing main page to " . $title->getPrefixedDBkey() . "\n" );
$article = new Article( $title );
$ucsite = ucfirst( $site );