r80248 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80247‎ | r80248 | r80249 >
Date:10:51, 14 January 2011
Author:dantman
Status:resolved (Comments)
Tags:
Comment:
Implement Message::isBlank and Message::isDisabled.
And while we're at it... update a random assortment of code using wfEmptyMsg to use the new wfMessage class and our exists/isBlank/isDisabled methods.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/ChangeTags.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/Interwiki.php (modified) (history)
  • /trunk/phase3/includes/Licenses.php (modified) (history)
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/Message.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/includes/ProtectionForm.php (modified) (history)
  • /trunk/phase3/includes/RawPage.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListgrouprights.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialStatistics.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialTags.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadBase.php
@@ -1179,9 +1179,9 @@
11801180 */
11811181 public static function getFilenamePrefixBlacklist() {
11821182 $blacklist = array();
1183 - $message = wfMsgForContent( 'filename-prefix-blacklist' );
1184 - if( $message && !( wfEmptyMsg( 'filename-prefix-blacklist', $message ) || $message == '-' ) ) {
1185 - $lines = explode( "\n", $message );
 1183+ $message = wfMessage( 'filename-prefix-blacklist' )->inContentLanguage();
 1184+ if( !$message->isDisabled() ) {
 1185+ $lines = explode( "\n", $message->plain() );
11861186 foreach( $lines as $line ) {
11871187 // Remove comment lines
11881188 $comment = substr( trim( $line ), 0, 1 );
Index: trunk/phase3/includes/Interwiki.php
@@ -248,9 +248,8 @@
249249 * @return String
250250 */
251251 public function getName() {
252 - $key = 'interwiki-name-' . $this->mPrefix;
253 - $msg = wfMsgForContent( $key );
254 - return wfEmptyMsg( $key, $msg ) ? '' : $msg;
 252+ $msg = wfMessage( 'interwiki-name-' . $this->mPrefix )->inContentLanguage();
 253+ return !$msg->exists() ? '' : $msg;
255254 }
256255
257256 /**
@@ -259,8 +258,7 @@
260259 * @return String
261260 */
262261 public function getDescription() {
263 - $key = 'interwiki-desc-' . $this->mPrefix;
264 - $msg = wfMsgForContent( $key );
265 - return wfEmptyMsg( $key, $msg ) ? '' : $msg;
 262+ $msg = wfMessage( 'interwiki-desc-' . $this->mPrefix )->inContentLanguage();
 263+ return !$msg->exists() ? '' : $msg;
266264 }
267265 }
Index: trunk/phase3/includes/ProtectionForm.php
@@ -351,13 +351,10 @@
352352
353353 foreach( $this->mRestrictions as $action => $selected ) {
354354 /* Not all languages have V_x <-> N_x relation */
355 - $msg = wfMsg( 'restriction-' . $action );
356 - if( wfEmptyMsg( 'restriction-' . $action, $msg ) ) {
357 - $msg = $action;
358 - }
 355+ $msg = wfMessage( 'restriction-' . $action );
359356 $out .= "<tr><td>".
360357 Xml::openElement( 'fieldset' ) .
361 - Xml::element( 'legend', null, $msg ) .
 358+ Xml::element( 'legend', null, $msg->exists() ? $action : $msg->text() ) .
362359 Xml::openElement( 'table', array( 'id' => "mw-protect-table-$action" ) ) .
363360 "<tr><td>" . $this->buildSelector( $action, $selected ) . "</td></tr><tr><td>";
364361
@@ -565,11 +562,11 @@
566563 if( $permission == '' ) {
567564 return wfMsg( 'protect-default' );
568565 } else {
569 - $key = "protect-level-{$permission}";
570 - $msg = wfMsg( $key );
571 - if( wfEmptyMsg( $key, $msg ) )
572 - $msg = wfMsg( 'protect-fallback', $permission );
573 - return $msg;
 566+ $msg = wfMessage( "protect-level-{$permission}" );
 567+ if( !$msg->exists() ) {
 568+ return $msg->text();
 569+ }
 570+ return wfMsg( 'protect-fallback', $permission );
574571 }
575572 }
576573
Index: trunk/phase3/includes/User.php
@@ -3181,11 +3181,8 @@
31823182 * @return String Localized descriptive group name
31833183 */
31843184 static function getGroupName( $group ) {
3185 - $key = "group-$group";
3186 - $name = wfMsg( $key );
3187 - return $name == '' || wfEmptyMsg( $key, $name )
3188 - ? $group
3189 - : $name;
 3185+ $msg = wfMessage( "group-$group" );
 3186+ return $msg->isBlank() ? $group : $msg->text();
31903187 }
31913188
31923189 /**
@@ -3195,11 +3192,8 @@
31963193 * @return String Localized name for group member
31973194 */
31983195 static function getGroupMember( $group ) {
3199 - $key = "group-$group-member";
3200 - $name = wfMsg( $key );
3201 - return $name == '' || wfEmptyMsg( $key, $name )
3202 - ? $group
3203 - : $name;
 3196+ $msg = wfMessage( "group-$group-member" );
 3197+ return $msg->isBlank() ? $group : $msg->text();
32043198 }
32053199
32063200 /**
@@ -3251,9 +3245,9 @@
32523246 * @return Title|Bool Title of the page if it exists, false otherwise
32533247 */
32543248 static function getGroupPage( $group ) {
3255 - $page = wfMsgForContent( 'grouppage-' . $group );
3256 - if( !wfEmptyMsg( 'grouppage-' . $group, $page ) ) {
3257 - $title = Title::newFromText( $page );
 3249+ $msg = wfMessage( 'grouppage-' . $group )->inContentLanguage();
 3250+ if( !$msg->exists() ) {
 3251+ $title = Title::newFromText( $msg->text() );
32583252 if( is_object( $title ) )
32593253 return $title;
32603254 }
Index: trunk/phase3/includes/Article.php
@@ -1270,8 +1270,7 @@
12711271 global $wgOut;
12721272
12731273 if ( $this->mTitle->isTalkPage() ) {
1274 - $msg = wfMsgNoTrans( 'talkpageheader' );
1275 - if ( $msg !== '-' && !wfEmptyMsg( 'talkpageheader', $msg ) ) {
 1274+ if ( !wfMessage( 'talkpageheader' )->isDisabled() ) {
12761275 $wgOut->wrapWikiMsg( "<div class=\"mw-talkpageheader\">\n$1\n</div>", array( 'talkpageheader' ) );
12771276 }
12781277 }
@@ -3843,8 +3842,7 @@
38443843 # Show user links if allowed to see them. If hidden, then show them only if requested...
38453844 $userlinks = $sk->revUserTools( $revision, !$unhide );
38463845
3847 - $m = wfMsg( 'revision-info-current' );
3848 - $infomsg = $current && !wfEmptyMsg( 'revision-info-current', $m ) && $m != '-'
 3846+ $infomsg = $current && !wfMessage( 'revision-info-current' )->isDisabled()
38493847 ? 'revision-info-current'
38503848 : 'revision-info';
38513849
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2004,11 +2004,12 @@
20052005 return false;
20062006 }
20072007 } else {
2008 - $notice = wfMsgForContentNoTrans( $name );
2009 - if( wfEmptyMsg( $name, $notice ) || $notice == '-' ) {
 2008+ $msg = wfMessage( $name )->inContentLanguage();
 2009+ if( $msg->isDisabled() ) {
20102010 wfProfileOut( $fname );
20112011 return( false );
20122012 }
 2013+ $notice = $msg->plain();
20132014 }
20142015
20152016 // Use the extra hash appender to let eg SSL variants separately cache.
Index: trunk/phase3/includes/Licenses.php
@@ -111,8 +111,8 @@
112112 }
113113
114114 protected function msg( $str ) {
115 - $out = wfMsg( $str );
116 - return wfEmptyMsg( $str, $out ) ? $str : $out;
 115+ $msg = wfMessage( $str );
 116+ return $msg->exists() ? $msg->text() : $str;
117117 }
118118
119119 /**#@-*/
Index: trunk/phase3/includes/parser/Parser.php
@@ -3355,12 +3355,12 @@
33563356 $text = $rev->getText();
33573357 } elseif ( $title->getNamespace() == NS_MEDIAWIKI ) {
33583358 global $wgContLang;
3359 - $message = $wgContLang->lcfirst( $title->getText() );
3360 - $text = wfMsgForContentNoTrans( $message );
3361 - if ( wfEmptyMsg( $message, $text ) ) {
 3359+ $message = wfMessage( $wgContLang->lcfirst( $title->getText() ) )->inContentLanguage();
 3360+ if ( !$message->exists() ) {
33623361 $text = false;
33633362 break;
33643363 }
 3364+ $text = $message->plain();
33653365 } else {
33663366 break;
33673367 }
Index: trunk/phase3/includes/ImagePage.php
@@ -120,9 +120,9 @@
121121
122122 # Show shared description, if needed
123123 if ( $this->mExtraDescription ) {
124 - $fol = wfMsgNoTrans( 'shareddescriptionfollows' );
125 - if ( $fol != '-' && !wfEmptyMsg( 'shareddescriptionfollows', $fol ) ) {
126 - $wgOut->addWikiText( $fol );
 124+ $fol = wfMessage( 'shareddescriptionfollows' );
 125+ if ( !$fol->isDisabled() ) {
 126+ $wgOut->addWikiText( $fol->plain() );
127127 }
128128 $wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . "</div>\n" );
129129 }
Index: trunk/phase3/includes/ChangeTags.php
@@ -28,11 +28,8 @@
2929 }
3030
3131 static function tagDescription( $tag ) {
32 - $msg = wfMsgExt( "tag-$tag", 'parseinline' );
33 - if ( wfEmptyMsg( "tag-$tag", $msg ) ) {
34 - return htmlspecialchars( $tag );
35 - }
36 - return $msg;
 32+ $msg = wfMessage( "tag-$tag" );
 33+ return $msg->exists() ? $msg->parse() : htmlspecialchars( $tag );
3734 }
3835
3936 ## Basic utility method to add tags to a particular change, given its rc_id, rev_id and/or log_id.
Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -657,11 +657,7 @@
658658 return null;
659659 }
660660 // 'shared-repo-name-wikimediacommons' is used when $wgUseInstantCommons = true
661 - $repoName = wfMsg( 'shared-repo-name-' . $this->name );
662 - if ( !wfEmptyMsg( 'shared-repo-name-' . $this->name, $repoName ) ) {
663 - return $repoName;
664 - }
665 - return wfMsg( 'shared-repo' );
 661+ return wfMessageFallback( 'shared-repo-name-' . $this->name, 'shared-repo' )->text();
666662 }
667663
668664 /**
Index: trunk/phase3/includes/EditPage.php
@@ -390,16 +390,18 @@
391391
392392 # Optional notices on a per-namespace and per-page basis
393393 $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
394 - if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) {
395 - $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) );
 394+ $editnotice_ns_message = wfMessage( $editnotice_ns )->inContentLanguage();
 395+ if ( !$editnotice_ns_message->empty() ) {
 396+ $wgOut->addWikiText( $editnotice_ns_msg->plain() ) );
396397 }
397398 if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
398399 $parts = explode( '/', $this->mTitle->getDBkey() );
399400 $editnotice_base = $editnotice_ns;
400401 while ( count( $parts ) > 0 ) {
401402 $editnotice_base .= '-'.array_shift( $parts );
402 - if ( !wfEmptyMsg( $editnotice_base, wfMsgForContent( $editnotice_base ) ) ) {
403 - $wgOut->addWikiText( wfMsgForContent( $editnotice_base ) );
 403+ $editnotice_base_msg = wfMessage( $editnotice_base )->inContentLanguage();
 404+ if ( !$editnotice_base_msg->exists() ) {
 405+ $wgOut->addWikiText( $editnotice_base_msg->plain() );
404406 }
405407 }
406408 }
@@ -1483,9 +1485,7 @@
14841486 $wgOut->wrapWikiMsg( "<div class='error' id='mw-edit-longpageerror'>\n$1\n</div>",
14851487 array( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgLang->formatNum( $wgMaxArticleSize ) ) );
14861488 } else {
1487 - $msg = 'longpage-hint';
1488 - $text = wfMsg( $msg );
1489 - if( !wfEmptyMsg( $msg, $text ) && $text !== '-' ) {
 1489+ if( !wfMessage('longpage-hint')->isDisabled() ) {
14901490 $wgOut->wrapWikiMsg( "<div id='mw-edit-longpage-hint'>\n$1\n</div>",
14911491 array( 'longpage-hint', $wgLang->formatSize( strlen( $this->textbox1 ) ), strlen( $this->textbox1 ) )
14921492 );
@@ -1741,8 +1741,7 @@
17421742 protected function showTosSummary() {
17431743 $msg = 'editpage-tos-summary';
17441744 wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) );
1745 - $text = wfMsg( $msg );
1746 - if( !wfEmptyMsg( $msg, $text ) && $text !== '-' ) {
 1745+ if( !wfMessage( $msg )->isDisabled() ) {
17471746 global $wgOut;
17481747 $wgOut->addHTML( '<div class="mw-tos-summary">' );
17491748 $wgOut->addWikiMsgArray( $msg, array() );
Index: trunk/phase3/includes/Message.php
@@ -308,6 +308,24 @@
309309 return $this->fetchMessage() !== false;
310310 }
311311
 312+ /**
 313+ * Check whether a message does not exist, or is an empty string
 314+ * @return Bool: true if is is and false if not
 315+ */
 316+ public function isBlank() {
 317+ $message = $this->fetchMessage();
 318+ return $message === false || $message == '';
 319+ }
 320+
 321+ /**
 322+ * Check whether a message does not exist, is an empty string, or is "-"
 323+ * @return Bool: true if is is and false if not
 324+ */
 325+ public function isDisabled() {
 326+ $message = $this->fetchMessage();
 327+ return $message === false || $message == '' || $message == '-';
 328+ }
 329+
312330 public static function rawParam( $value ) {
313331 return array( 'raw' => $value );
314332 }
Index: trunk/phase3/includes/RawPage.php
@@ -189,11 +189,9 @@
190190 // If it's a MediaWiki message we can just hit the message cache
191191 if( $this->mUseMessageCache && $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
192192 $key = $this->mTitle->getDBkey();
193 - $text = wfMsgForContentNoTrans( $key );
 193+ $msg = wfMessage( $key )->inContentLanguage();
194194 # If the message doesn't exist, return a blank
195 - if( wfEmptyMsg( $key, $text ) ) {
196 - $text = '';
197 - }
 195+ $text = !$msg->exists() ? '' : $msg->plain();
198196 $found = true;
199197 } else {
200198 // Get it from the DB
Index: trunk/phase3/includes/specials/SpecialStatistics.php
@@ -98,9 +98,9 @@
9999 $text .= Xml::closeElement( 'table' );
100100
101101 # Customizable footer
102 - $footer = wfMsgExt( 'statistics-footer', array('parseinline') );
103 - if( !wfEmptyMsg( 'statistics-footer', $footer ) && $footer != '' ) {
104 - $text .= "\n" . $footer;
 102+ $footer = wfMessage( 'statistics-footer' );
 103+ if ( !$footer->isBlank() ) {
 104+ $text .= "\n" . $footer->parse();
105105 }
106106
107107 $wgOut->addHTML( $text );
@@ -117,11 +117,11 @@
118118 */
119119 private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) {
120120 if( $descMsg ) {
121 - $descriptionText = wfMsgExt( $descMsg, array( 'parseinline' ), $descMsgParam );
122 - if ( !wfEmptyMsg( $descMsg, $descriptionText ) ) {
123 - $descriptionText = " ($descriptionText)";
 121+ $msg = wfMessage( $descMsg, $descMsgParam );
 122+ if ( $msg->exists() ) {
 123+ $descriptionText = $msg->parse();
124124 $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
125 - $descriptionText );
 125+ " ($descriptionText)" );
126126 }
127127 }
128128 return
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -1186,9 +1186,9 @@
11871187 function makeLanguageSelector() {
11881188 global $wgLang;
11891189
1190 - $msg = wfMsgForContent( 'loginlanguagelinks' );
1191 - if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) {
1192 - $langs = explode( "\n", $msg );
 1190+ $msg = wfMessage( 'loginlanguagelinks' )->inContentLanguage();
 1191+ if( !$msg->isBlank() ) {
 1192+ $langs = explode( "\n", $msg->text() );
11931193 $links = array();
11941194 foreach( $langs as $lang ) {
11951195 $lang = trim( $lang, '* ' );
Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -161,8 +161,7 @@
162162 }
163163 }
164164
165 - $text = wfMsgNoTrans( $message, $target );
166 - if( !wfEmptyMsg( $message, $text ) && $text != '-' ) {
 165+ if( !wfMessage( $message, $target )->isDisabled() ) {
167166 $wgOut->wrapWikiMsg(
168167 "<div class='mw-contributions-footer'>\n$1\n</div>",
169168 array( $message, $target ) );
Index: trunk/phase3/includes/specials/SpecialListgrouprights.php
@@ -78,19 +78,13 @@
7979 ? 'all'
8080 : $group;
8181
82 - $msg = wfMsg( 'group-' . $groupname );
83 - if ( wfEmptyMsg( 'group-' . $groupname, $msg ) || $msg == '' ) {
84 - $groupnameLocalized = $groupname;
85 - } else {
86 - $groupnameLocalized = $msg;
87 - }
 82+ $msg = wfMessage( 'group-' . $groupname );
 83+ $groupnameLocalized = !$msg->isBlank() ? $msg->text() : $groupname;
8884
89 - $msg = wfMsgForContent( 'grouppage-' . $groupname );
90 - if ( wfEmptyMsg( 'grouppage-' . $groupname, $msg ) || $msg == '' ) {
91 - $grouppageLocalized = MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname;
92 - } else {
93 - $grouppageLocalized = $msg;
94 - }
 85+ $msg = wfMessage( 'grouppage-' . $groupname )->inContentLanguage();
 86+ $grouppageLocalized = !$msg->isBlank() ?
 87+ $msg->text() :
 88+ MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname;
9589
9690 if( $group == '*' ) {
9791 // Do not make a link for the generic * group
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -285,10 +285,10 @@
286286 $form->addPreText( $message );
287287
288288 # Add footer to form
289 - $uploadFooter = wfMsgNoTrans( 'uploadfooter' );
290 - if ( $uploadFooter != '-' && !wfEmptyMsg( 'uploadfooter', $uploadFooter ) ) {
 289+ $uploadFooter = wfMessage( 'uploadfooter' );
 290+ if ( !$uploadFooter->isDisabled() ) {
291291 $form->addPostText( '<div id="mw-upload-footer-message">'
292 - . $wgOut->parse( $uploadFooter ) . "</div>\n" );
 292+ . $wgOut->parse( $uploadFooter->plain() ) . "</div>\n" );
293293 }
294294
295295 return $form;
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -340,9 +340,7 @@
341341 ? 'sp-contributions-footer-anon'
342342 : 'sp-contributions-footer';
343343
344 -
345 - $text = wfMsgNoTrans( $message, $target );
346 - if( !wfEmptyMsg( $message, $text ) && $text != '-' ) {
 344+ if( !wfMessage( $message )->isDisabled() ) {
347345 $wgOut->wrapWikiMsg( "<div class='mw-contributions-footer'>\n$1\n</div>", array( $message, $target ) );
348346 }
349347 }
Index: trunk/phase3/includes/specials/SpecialTags.php
@@ -82,8 +82,8 @@
8383 $disp .= ' (' . $sk->link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ), wfMsgHtml( 'tags-edit' ) ) . ')';
8484 $newRow .= Xml::tags( 'td', null, $disp );
8585
86 - $desc = wfMsgExt( "tag-$tag-description", 'parseinline' );
87 - $desc = wfEmptyMsg( "tag-$tag-description", $desc ) ? '' : $desc;
 86+ $msg = wfMessage( "tag-$tag-description" );
 87+ $desc = !$msg->exists() ? '' : $msg->parse();
8888 $desc .= ' (' . $sk->link( Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ), wfMsgHtml( 'tags-edit' ) ) . ')';
8989 $newRow .= Xml::tags( 'td', null, $desc );
9090
Index: trunk/phase3/includes/Preferences.php
@@ -1013,10 +1013,9 @@
10141014 # Sort by UI skin name. First though need to update validSkinNames as sometimes
10151015 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
10161016 foreach ( $validSkinNames as $skinkey => &$skinname ) {
1017 - $msgName = "skinname-{$skinkey}";
1018 - $localisedSkinName = wfMsg( $msgName );
1019 - if ( !wfEmptyMsg( $msgName, $localisedSkinName ) ) {
1020 - $skinname = htmlspecialchars( $localisedSkinName );
 1017+ $msg = wfMessage( "skinname-{$skinkey}" );
 1018+ if ( $msg->exists() ) {
 1019+ $skinname = htmlspecialchars( $msg->text() );
10211020 }
10221021 }
10231022 asort( $validSkinNames );
Index: trunk/phase3/includes/SpecialPage.php
@@ -341,9 +341,10 @@
342342 if( isset($specialPageGroupsCache[$page->mName]) ) {
343343 return $specialPageGroupsCache[$page->mName];
344344 }
345 - $group = wfMsg('specialpages-specialpagegroup-'.strtolower($page->mName));
346 - if( $group == ''
347 - || wfEmptyMsg('specialpages-specialpagegroup-'.strtolower($page->mName), $group ) ) {
 345+ $msg = wfMessage('specialpages-specialpagegroup-'.strtolower($page->mName));
 346+ if ( !$msg->isBlank() ) {
 347+ $group = $msg->text();
 348+ } else {
348349 $group = isset($wgSpecialPageGroups[$page->mName])
349350 ? $wgSpecialPageGroups[$page->mName]
350351 : '-';
@@ -882,8 +883,7 @@
883884 } else {
884885 $msg = $summaryMessageKey;
885886 }
886 - $out = wfMsgNoTrans( $msg );
887 - if ( ! wfEmptyMsg( $msg, $out ) and $out !== '' and ! $this->including() ) {
 887+ if ( !wfMessage( $msg )->isBlank() and ! $this->including() ) {
888888 $wgOut->wrapWikiMsg( "<div class='mw-specialpage-summary'>\n$1\n</div>", $msg );
889889 }
890890
Index: trunk/phase3/includes/LogPage.php
@@ -514,13 +514,11 @@
515515 public static function formatBlockFlag( $flag, $forContent = false ) {
516516 static $messages = array();
517517 if( !isset( $messages[$flag] ) ) {
518 - $k = 'block-log-flags-' . $flag;
519 - if( $forContent ) {
520 - $msg = wfMsgForContent( $k );
521 - } else {
522 - $msg = wfMsg( $k );
 518+ $msg = wfMessage( 'block-log-flags-' . $flag );
 519+ if ( $forContent ) {
 520+ $msg = $msg->inContentLanguage();
523521 }
524 - $messages[$flag] = htmlspecialchars( wfEmptyMsg( $k, $msg ) ? $flag : $msg );
 522+ $messages[$flag] = htmlspecialchars( !$msg->exists() ? $flag : $msg );
525523 }
526524 return $messages[$flag];
527525 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r80252Fix remainder of the accidental ->empty() calls I used when converting wfEmpt...dantman11:36, 14 January 2011
r80261Fix for r80248: undefined variable.demon13:25, 14 January 2011
r80341Fix boolean for $editnotice_base message existance check that was messed up i...dantman22:46, 14 January 2011
r80393Fix mistake in r80248 and restructure a bitnikerabbit12:46, 15 January 2011
r80408Fix another bad boolean from r80248.dantman02:29, 16 January 2011
r92131* Fix r80248: login language links included a newline in the URL (%0D) so the...robin01:13, 14 July 2011
r94761Followup r80248; Fix inverted message exists tests in ProtectionForm.dantman14:10, 17 August 2011

Comments

#Comment by X! (talk | contribs)   02:25, 16 January 2011

It appears that this has broken 2 unit tests that deal with permissions. (cf. Tesla: http://ci.tesla.usability.wikimedia.org/cruisecontrol/buildresults/mw?log=log20110114110111)

#Comment by Dantman (talk | contribs)   04:42, 26 March 2011

Is this broken right now? Tesla lists a bunch of commits where 'one' of them might be the one that broke it, not necessarily this one. And with the follow ups, is it still broken?

#Comment by Platonides (talk | contribs)   01:15, 27 March 2011

You broke three tests, but they pass now (long story in wikitech).

#Comment by Mormegil (talk | contribs)   09:14, 16 August 2011

There are two still unfixed bad boolean checks in ProtectionForm.php: Both checks at http://goo.gl/urWec are inverted. See bugzilla:30391.

#Comment by Dantman (talk | contribs)   14:13, 17 August 2011

Should be fixed in r94761.

Status & tagging log