r97887 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97886‎ | r97887 | r97888 >
Date:05:43, 23 September 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Replaced use of wfEmptyMsg() with new Message class. The underlying implementation changed and caused an unstub loop in some cases (like with filecache enabled). Unstubbing $wgLang requires loading $wgUser which triggers a gadget hook, which should not require unstubbing the user's language.
Modified paths:
  • /trunk/extensions/Gadgets/Gadgets_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Gadgets/Gadgets_body.php
@@ -16,7 +16,7 @@
1717
1818 /**
1919 * ArticleSaveComplete hook handler.
20 - *
 20+ *
2121 * @param $article Article
2222 * @param $user User
2323 * @param $text String: New page text
@@ -56,7 +56,7 @@
5757 public static function getPreferences( $user, &$preferences ) {
5858 $gadgets = Gadget::loadStructuredList();
5959 if (!$gadgets) return true;
60 -
 60+
6161 $options = array();
6262 $default = array();
6363 foreach( $gadgets as $section => $thisSection ) {
@@ -79,7 +79,7 @@
8080 $options = array_merge( $options, $available );
8181 }
8282 }
83 -
 83+
8484 $preferences['gadgets-intro'] =
8585 array(
8686 'type' => 'info',
@@ -91,8 +91,8 @@
9292 'raw' => 1,
9393 'rawrow' => 1,
9494 );
95 -
96 - $preferences['gadgets'] =
 95+
 96+ $preferences['gadgets'] =
9797 array(
9898 'type' => 'multiselect',
9999 'options' => $options,
@@ -101,7 +101,7 @@
102102 'prefix' => 'gadget-',
103103 'default' => $default,
104104 );
105 -
 105+
106106 return true;
107107 }
108108
@@ -129,7 +129,7 @@
130130 */
131131 public static function beforePageDisplay( $out ) {
132132 global $wgUser;
133 -
 133+
134134 wfProfileIn( __METHOD__ );
135135
136136 $gadgets = Gadget::loadList();
@@ -169,7 +169,7 @@
170170
171171 /**
172172 * Adds one legacy script to output.
173 - *
 173+ *
174174 * @param $page String: Unprefixed page title
175175 * @param $out OutputPage
176176 */
@@ -354,8 +354,8 @@
355355 * @return Boolean: Whether this gadget has resources that can be loaded via ResourceLoader
356356 */
357357 public function hasModule() {
358 - return count( $this->styles )
359 - + ( $this->supportsResourceLoader() ? count( $this->scripts ) : 0 )
 358+ return count( $this->styles )
 359+ + ( $this->supportsResourceLoader() ? count( $this->scripts ) : 0 )
360360 > 0;
361361 }
362362
@@ -506,12 +506,13 @@
507507 return $gadgets;
508508 }
509509
510 - $g = wfMsgForContentNoTrans( "gadgets-definition" );
511 - if ( wfEmptyMsg( "gadgets-definition", $g ) ) {
 510+ $g = wfMessage( "gadgets-definition" )->inContentLanguage();
 511+ if ( !$g->exists() ) {
512512 $gadgets = false;
513513 wfProfileOut( __METHOD__ );
514514 return $gadgets;
515515 }
 516+ $g = $g->plain();
516517 } else {
517518 $g = $forceNewText;
518519 }

Sign-offs

UserFlagDate
Brion VIBBERinspected18:43, 26 September 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r100755REL1_16 MFT r97887, r100573, r100689, r100692reedy22:15, 25 October 2011
r1029441.18wmf1: MFT r97887catrope07:54, 14 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97367[ResourceLoader] Set default options for gadgets that are enabled by default,...krinkle03:03, 17 September 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   05:46, 23 September 2011

Komodo cleaning whitespace automatically ;)

#Comment by Catrope (talk | contribs)   18:45, 26 September 2011

Does this fix the unstub loop in r97367

#Comment by Aaron Schulz (talk | contribs)   18:49, 26 September 2011

Yeah, the pasted error on the CR comment for r97367 is the same error this fixed.

#Comment by Catrope (talk | contribs)   07:53, 14 November 2011

This also fixes the unstub loop reported on bug 31419 (occurred when TitleBlacklist blocked a CentralAuth auto-creation).

Status & tagging log