r71665 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71664‎ | r71665 | r71666 >
Date:22:00, 25 August 2010
Author:catrope
Status:deferred
Tags:
Comment:
resourceloader: Kill getParameter()/setParameter() with fire, as promised in the FIXME comments, and replace its sole usage with a skin-specific script
Modified paths:
  • /branches/resourceloader/phase3/includes/ResourceLoader.php (modified) (history)
  • /branches/resourceloader/phase3/includes/ResourceLoaderModule.php (modified) (history)

Diff [purge]

Index: branches/resourceloader/phase3/includes/ResourceLoader.php
@@ -208,12 +208,6 @@
209209 $includeMessages = true;
210210 }
211211
212 - // Set parameters on all modules
213 - // FIXME: This sucks
214 - foreach ( self::$modules as $module ) {
215 - $module->setParameters( $parameters );
216 - }
217 -
218212 // Build a list of requested modules excluding unrecognized ones which are collected into a list used to
219213 // register the unrecognized modules with error status later on
220214 $modules = array();
Index: branches/resourceloader/phase3/includes/ResourceLoaderModule.php
@@ -207,16 +207,6 @@
208208 }
209209
210210 /**
211 - * Set parameters used for obtaining this module. Ignored in this class
212 - * but used in subclasses.
213 - *
214 - * FIXME: This is ugly and should ideally be killed with fire. I just don't know how else to do skin JS ATM.
215 - */
216 - public function setParameters( $params ) {
217 - $this->parameters = $params;
218 - }
219 -
220 - /**
221211 * Get the primary JS for this module. This is pulled from the
222212 * script files added through addScripts()
223213 * @return string JS
@@ -316,15 +306,6 @@
317307 }
318308
319309 /**
320 - * Get a parameter previously set through setParameters()
321 - * @param $param string Parameter name
322 - * @return mixed Parameter value or null if not set
323 - */
324 - public function getParameter( $param ) {
325 - return isset( $this->parameters[$param] ) ? $this->parameters[$param] : null;
326 - }
327 -
328 - /**
329310 * Get the contents of a set of files and concatenate them, with
330311 * newlines in between. Each file is used only once.
331312 * @param $files array Array of file names
@@ -337,17 +318,17 @@
338319 }
339320
340321 class ResourceLoaderSiteJSModule extends ResourceLoaderModule {
341 - public function getScript() {
342 - return Skin::newFromKey( $this->getParameter( 'skin' ) )->generateUserJs();
 322+ public function getSkinScript( $skin ) {
 323+ return Skin::newFromKey( $skin )->generateUserJs();
343324 }
344325
345326 // Dummy overrides to return emptyness
 327+ public function getScript() { return ''; }
346328 public function getStyle() { return ''; }
347329 public function getMessages() { return array(); }
348330 public function getDependencies() { return array(); }
349331 public function getDebugScript() { return ''; }
350332 public function getLanguageScript( $lang ) { return ''; }
351 - public function getSkinScript( $skin ) { return ''; }
352333 public function getSkinStyle( $skin ) { return ''; }
353334 public function getLoaderScript() { return false; }
354335 }

Status & tagging log