Index: trunk/phase3/maintenance/addwiki.php |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | | - $title = Title::newFromText( wfMsgWeirdKey( "mainpage/$lang" ) ); |
| 133 | + $title = Title::newFromText( wfMessage( 'mainpage' )->inLanguage( $lang )->useDatabase( false )->plain() ); |
134 | 134 | $this->output( "Writing main page to " . $title->getPrefixedDBkey() . "\n" ); |
135 | 135 | $article = new Article( $title ); |
136 | 136 | $ucsite = ucfirst( $site ); |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -257,7 +257,7 @@ |
258 | 258 | # If this is a MediaWiki:x message, then load the messages |
259 | 259 | # and return the message value for x. |
260 | 260 | if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { |
261 | | - $text = $this->getDefaultMessageText(); |
| 261 | + $text = $this->mTitle->getDefaultMessageText(); |
262 | 262 | if ( $text === false ) { |
263 | 263 | $text = ''; |
264 | 264 | } |
— | — | @@ -276,28 +276,6 @@ |
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | | - * Get the default message text or false if the message doesn't exist |
281 | | - * |
282 | | - * @return String or false |
283 | | - */ |
284 | | - public function getDefaultMessageText() { |
285 | | - global $wgContLang; |
286 | | - |
287 | | - if ( $this->mTitle->getNamespace() != NS_MEDIAWIKI ) { // Just in case |
288 | | - return false; |
289 | | - } |
290 | | - |
291 | | - list( $name, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) ); |
292 | | - $message = wfMessage( $name )->inLanguage( $lang )->useDatabase( false ); |
293 | | - |
294 | | - if ( $message->exists() ) { |
295 | | - return $message->plain(); |
296 | | - } else { |
297 | | - return false; |
298 | | - } |
299 | | - } |
300 | | - |
301 | | - /** |
302 | 280 | * Get the text of the current revision. No side-effects... |
303 | 281 | * |
304 | 282 | * @return Return the text of the current revision |
— | — | @@ -1411,7 +1389,7 @@ |
1412 | 1390 | wfMsgNoTrans( 'missingarticle-rev', $oldid ) ); |
1413 | 1391 | } elseif ( $this->mTitle->getNamespace() === NS_MEDIAWIKI ) { |
1414 | 1392 | // Use the default message text |
1415 | | - $text = $this->getDefaultMessageText(); |
| 1393 | + $text = $this->mTitle->getDefaultMessageText(); |
1416 | 1394 | } else { |
1417 | 1395 | $createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser ); |
1418 | 1396 | $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ); |
— | — | @@ -4162,7 +4140,7 @@ |
4163 | 4141 | if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { |
4164 | 4142 | // This doesn't quite make sense; the user is asking for |
4165 | 4143 | // information about the _page_, not the message... -- RC |
4166 | | - $wgOut->addHTML( htmlspecialchars( wfMsgWeirdKey( $this->mTitle->getText() ) ) ); |
| 4144 | + $wgOut->addHTML( htmlspecialchars( $this->mTitle->getDefaultMessageText() ) ); |
4167 | 4145 | } else { |
4168 | 4146 | $msg = $wgUser->isLoggedIn() |
4169 | 4147 | ? 'noarticletext' |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -607,7 +607,9 @@ |
608 | 608 | |
609 | 609 | /** |
610 | 610 | * This function provides the message source for messages to be edited which are *not* stored in the database. |
611 | | - * @param $key String: |
| 611 | + * |
| 612 | + * @deprecated in 1.18; use wfMessage() |
| 613 | + * @param $key String |
612 | 614 | */ |
613 | 615 | function wfMsgWeirdKey( $key ) { |
614 | 616 | $source = wfMsgGetKey( $key, false, true, false ); |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | if ( !$this->mTitle->exists() ) { |
143 | 143 | if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { |
144 | 144 | # If this is a system message, get the default text. |
145 | | - $text = $this->mArticle->getDefaultMessageText(); |
| 145 | + $text = $this->mTitle->getDefaultMessageText(); |
146 | 146 | if( $text === false ) { |
147 | 147 | $text = $this->getPreloadedText( $preload ); |
148 | 148 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -3760,12 +3760,8 @@ |
3761 | 3761 | // selflink, possibly with fragment |
3762 | 3762 | return $this->mDbkeyform == ''; |
3763 | 3763 | case NS_MEDIAWIKI: |
3764 | | - // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes |
3765 | | - // the full l10n of that language to be loaded. That takes much memory and |
3766 | | - // isn't needed. So we strip the language part away. |
3767 | | - list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 ); |
3768 | 3764 | // known system message |
3769 | | - return (bool)wfMsgWeirdKey( $basename ); |
| 3765 | + return $this->getDefaultMessageText() !== false; |
3770 | 3766 | default: |
3771 | 3767 | return false; |
3772 | 3768 | } |
— | — | @@ -3796,17 +3792,35 @@ |
3797 | 3793 | if ( $this->mNamespace == NS_MEDIAWIKI ) { |
3798 | 3794 | // If the page doesn't exist but is a known system message, default |
3799 | 3795 | // message content will be displayed, same for language subpages |
3800 | | - // Also, if the page is form Mediawiki:message/lang, calling wfMsgWeirdKey |
3801 | | - // causes the full l10n of that language to be loaded. That takes much |
3802 | | - // memory and isn't needed. So we strip the language part away. |
3803 | | - list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 ); |
3804 | | - return (bool)wfMsgWeirdKey( $basename ); |
| 3796 | + return $this->getDefaultMessageText() !== false; |
3805 | 3797 | } |
3806 | 3798 | |
3807 | 3799 | return false; |
3808 | 3800 | } |
3809 | 3801 | |
3810 | 3802 | /** |
| 3803 | + * Get the default message text or false if the message doesn't exist |
| 3804 | + * |
| 3805 | + * @return String or false |
| 3806 | + */ |
| 3807 | + public function getDefaultMessageText() { |
| 3808 | + global $wgContLang; |
| 3809 | + |
| 3810 | + if ( $this->getNamespace() != NS_MEDIAWIKI ) { // Just in case |
| 3811 | + return false; |
| 3812 | + } |
| 3813 | + |
| 3814 | + list( $name, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->getText() ) ); |
| 3815 | + $message = wfMessage( $name )->inLanguage( $lang )->useDatabase( false ); |
| 3816 | + |
| 3817 | + if ( $message->exists() ) { |
| 3818 | + return $message->plain(); |
| 3819 | + } else { |
| 3820 | + return false; |
| 3821 | + } |
| 3822 | + } |
| 3823 | + |
| 3824 | + /** |
3811 | 3825 | * Is this in a namespace that allows actual pages? |
3812 | 3826 | * |
3813 | 3827 | * @return Bool |