http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95083
Revision: 95083 Author: salvatoreingala Date: 2011-08-20 13:41:16 +0000 (Sat, 20 Aug 2011) Log Message: ----------- Simplification of GadgetLoaderResourceLoaderModule, there is no need to make it depend on the mTime of the preferences description page. Modified Paths: -------------- branches/salvatoreingala/Gadgets/backend/GadgetResourceLoaderModule.php Modified: branches/salvatoreingala/Gadgets/backend/GadgetResourceLoaderModule.php =================================================================== --- branches/salvatoreingala/Gadgets/backend/GadgetResourceLoaderModule.php 2011-08-20 13:32:18 UTC (rev 95082) +++ branches/salvatoreingala/Gadgets/backend/GadgetResourceLoaderModule.php 2011-08-20 13:41:16 UTC (rev 95083) @@ -66,31 +66,11 @@ * @return String */ public function getScript( ResourceLoaderContext $context ) { - $prefs = $this->gadget->getPrefs(); - //Enclose gadget's code in a closure, with "this" bound to the //configuration object (or to "window" for non-configurable gadgets) - $header = "(function(){"; - - if ( $prefs !== null ) { - //Bind gadget info to "this". - $footer = "}).apply( mw.gadgets.info.get('{$this->gadget->getName()}') );"; - } else { - //Bind window to "this" - $footer = "}).apply( window );"; - } - - return $header . parent::getScript( $context ) . $footer; + return "( function() {\n" + . parent::getScript( $context ) + . "} ).apply( mw.gadgets.info.get( '{$this->gadget->getName()}' ) || window );"; } - - /** - * Overrides ResourceLoaderModule::getModifiedTime() - * @param $context ResourceLoaderContext - * @return Integer - */ - public function getModifiedTime( ResourceLoaderContext $context ) { - //TODO: should also depend on the mTime of preferences description page - return parent::getModifiedTime( $context ); - } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs