r95083 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95082‎ | r95083 | r95084 >
Date:13:41, 20 August 2011
Author:salvatoreingala
Status:deferred
Tags:
Comment:
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) (history)

Diff [purge]

Index: branches/salvatoreingala/Gadgets/backend/GadgetResourceLoaderModule.php
@@ -66,31 +66,11 @@
6767 * @return String
6868 */
6969 public function getScript( ResourceLoaderContext $context ) {
70 - $prefs = $this->gadget->getPrefs();
71 -
7270 //Enclose gadget's code in a closure, with "this" bound to the
7371 //configuration object (or to "window" for non-configurable gadgets)
74 - $header = "(function(){";
75 -
76 - if ( $prefs !== null ) {
77 - //Bind gadget info to "this".
78 - $footer = "}).apply( mw.gadgets.info.get('{$this->gadget->getName()}') );";
79 - } else {
80 - //Bind window to "this"
81 - $footer = "}).apply( window );";
82 - }
83 -
84 - return $header . parent::getScript( $context ) . $footer;
 72+ return "( function() {\n"
 73+ . parent::getScript( $context )
 74+ . "} ).apply( mw.gadgets.info.get( '{$this->gadget->getName()}' ) || window );";
8575 }
86 -
87 - /**
88 - * Overrides ResourceLoaderModule::getModifiedTime()
89 - * @param $context ResourceLoaderContext
90 - * @return Integer
91 - */
92 - public function getModifiedTime( ResourceLoaderContext $context ) {
93 - //TODO: should also depend on the mTime of preferences description page
94 - return parent::getModifiedTime( $context );
95 - }
9676 }
9777

Status & tagging log