http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97887

Revision: 97887
Author:   aaron
Date:     2011-09-23 05:43:40 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
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: trunk/extensions/Gadgets/Gadgets_body.php
===================================================================
--- trunk/extensions/Gadgets/Gadgets_body.php   2011-09-23 03:38:14 UTC (rev 
97886)
+++ trunk/extensions/Gadgets/Gadgets_body.php   2011-09-23 05:43:40 UTC (rev 
97887)
@@ -16,7 +16,7 @@
 
        /**
         * ArticleSaveComplete hook handler.
-        * 
+        *
         * @param $article Article
         * @param $user User
         * @param $text String: New page text
@@ -56,7 +56,7 @@
        public static function getPreferences( $user, &$preferences ) {
                $gadgets = Gadget::loadStructuredList();
                if (!$gadgets) return true;
-               
+
                $options = array();
                $default = array();
                foreach( $gadgets as $section => $thisSection ) {
@@ -79,7 +79,7 @@
                                $options = array_merge( $options, $available );
                        }
                }
-               
+
                $preferences['gadgets-intro'] =
                        array(
                                'type' => 'info',
@@ -91,8 +91,8 @@
                                'raw' => 1,
                                'rawrow' => 1,
                        );
-               
-               $preferences['gadgets'] = 
+
+               $preferences['gadgets'] =
                        array(
                                'type' => 'multiselect',
                                'options' => $options,
@@ -101,7 +101,7 @@
                                'prefix' => 'gadget-',
                                'default' => $default,
                        );
-                       
+
                return true;
        }
 
@@ -129,7 +129,7 @@
         */
        public static function beforePageDisplay( $out ) {
                global $wgUser;
-               
+
                wfProfileIn( __METHOD__ );
 
                $gadgets = Gadget::loadList();
@@ -169,7 +169,7 @@
 
        /**
         * Adds one legacy script to output.
-        * 
+        *
         * @param $page String: Unprefixed page title
         * @param $out OutputPage
         */
@@ -354,8 +354,8 @@
         * @return Boolean: Whether this gadget has resources that can be 
loaded via ResourceLoader
         */
        public function hasModule() {
-               return count( $this->styles ) 
-                       + ( $this->supportsResourceLoader() ? count( 
$this->scripts ) : 0 ) 
+               return count( $this->styles )
+                       + ( $this->supportsResourceLoader() ? count( 
$this->scripts ) : 0 )
                                > 0;
        }
 
@@ -506,12 +506,13 @@
                                return $gadgets;
                        }
 
-                       $g = wfMsgForContentNoTrans( "gadgets-definition" );
-                       if ( wfEmptyMsg( "gadgets-definition", $g ) ) {
+                       $g = wfMessage( "gadgets-definition" 
)->inContentLanguage();
+                       if ( !$g->exists() ) {
                                $gadgets = false;
                                wfProfileOut( __METHOD__ );
                                return $gadgets;
                        }
+                       $g = $g->plain();
                } else {
                        $g = $forceNewText;
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to