r77702 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77701‎ | r77702 | r77703 >
Date:00:48, 4 December 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fixes r77696 where a few mistakes were made. Also improves on r77693 by using actual group names rather than trying to divine the group from the module name...
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2436,11 +2436,10 @@
24372437
24382438 // Modules requests - let the client calculate dependencies and batch requests as it likes
24392439 if ( $this->getModules() ) {
2440 - $modules = FormatJson::encode( );
24412440 $scripts .= Html::inlineScript(
24422441 ResourceLoader::makeLoaderConditionalScript(
2443 - Xml::encodeJsCall( 'mediaWiki.loader.load', $this->getModules() ) .
2444 - Xml::encodeJsCall( 'mediaWiki.loader.go' )
 2442+ Xml::encodeJsCall( 'mediaWiki.loader.load', array( $this->getModules() ) ) .
 2443+ Xml::encodeJsCall( 'mediaWiki.loader.go', array() )
24452444 )
24462445 ) . "\n";
24472446 }
@@ -2588,15 +2587,16 @@
25892588 }
25902589 }
25912590 }
2592 -
2593 - // Add styles to tags, pushing user modules to the end
 2591+
 2592+ // Split the styles into two groups, not user (0) and user (1)
25942593 $styles = array( array(), array() );
2595 - foreach ( $this->getModuleStyles() as $module ) {
2596 - $styles[strpos( 'user', $module ) === 0 ? 1 : 0][] = $module;
 2594+ $resourceLoader = $this->getResourceLoader();
 2595+ foreach ( $this->getModuleStyles() as $name ) {
 2596+ $styles[$resourceLoader->getModule( $name )->getGroup() === 'user' ? 1 : 0][] = $name;
25972597 }
 2598+ // Add styles to tags, user modules last
25982599 $tags[] = $this->makeResourceLoaderLink( $sk, $styles[0], 'styles' );
25992600 $tags[] = $this->makeResourceLoaderLink( $sk, $styles[1], 'styles' );
2600 -
26012601 return implode( "\n", $tags );
26022602 }
26032603

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r77693Resolves bug #26131 by always placing user scripts and styles at the very end...tparscal23:59, 3 December 2010
r77696Made use of Xml::encodeJsCall - improves on r77693.tparscal00:35, 4 December 2010

Status & tagging log