Index: trunk/phase3/includes/Article.php |
— | — | @@ -257,12 +257,10 @@ |
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 | | - # If this is a system message, get the default text. |
262 | | - list( $message, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) ); |
263 | | - $text = wfMsgGetKey( $message, false, $lang, false ); |
264 | | - |
265 | | - if ( wfEmptyMsg( $message, $text ) ) |
| 261 | + $text = $this->getDefaultMessageText(); |
| 262 | + if ( $text === false ) { |
266 | 263 | $text = ''; |
| 264 | + } |
267 | 265 | } else { |
268 | 266 | $text = wfMsgExt( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon', 'parsemag' ); |
269 | 267 | } |
— | — | @@ -278,6 +276,28 @@ |
279 | 277 | } |
280 | 278 | |
281 | 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 | + /** |
282 | 302 | * Get the text of the current revision. No side-effects... |
283 | 303 | * |
284 | 304 | * @return Return the text of the current revision |
— | — | @@ -1391,7 +1411,7 @@ |
1392 | 1412 | wfMsgNoTrans( 'missingarticle-rev', $oldid ) ); |
1393 | 1413 | } elseif ( $this->mTitle->getNamespace() === NS_MEDIAWIKI ) { |
1394 | 1414 | // Use the default message text |
1395 | | - $text = $this->getContent(); |
| 1415 | + $text = $this->getDefaultMessageText(); |
1396 | 1416 | } else { |
1397 | 1417 | $createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser ); |
1398 | 1418 | $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ); |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -141,10 +141,10 @@ |
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 | | - list( $message, $lang ) = MessageCache::singleton()->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) ); |
146 | | - $text = wfMsgGetKey( $message, false, $lang, false ); |
147 | | - if( wfEmptyMsg( $message, $text ) ) |
| 145 | + $text = $this->mArticle->getDefaultMessageText(); |
| 146 | + if( $text === false ) { |
148 | 147 | $text = $this->getPreloadedText( $preload ); |
| 148 | + } |
149 | 149 | } else { |
150 | 150 | # If requested, preload some text. |
151 | 151 | $text = $this->getPreloadedText( $preload ); |