r78933 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78932‎ | r78933 | r78934 >
Date:23:26, 23 December 2010
Author:catrope
Status:ok
Tags:
Comment:
Revert r78023 and its follow-up r78802: change seems to have been made for somewhat cosmetic reasons ("it makes more sense for this to be here rather than there") and breaks stuff. Will reapply typo fix from r78802 in next commit
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2213,8 +2213,8 @@
22142214 $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
22152215
22162216 $ret .= implode( "\n", array(
2217 - $this->getHeadLinks(),
2218 - $this->buildCssLinks( $sk ),
 2217+ $this->getHeadLinks( $sk ),
 2218+ $this->buildCssLinks(),
22192219 $this->getHeadItems(),
22202220 ) );
22212221 if ( $sk->usercss ) {
@@ -2499,7 +2499,7 @@
25002500 /**
25012501 * @return string HTML tag links to be put in the header.
25022502 */
2503 - public function getHeadLinks() {
 2503+ public function getHeadLinks( Skin $sk ) {
25042504 global $wgFeed;
25052505
25062506 // Ideally this should happen earlier, somewhere. :P
@@ -2570,6 +2570,19 @@
25712571 }
25722572 }
25732573
 2574+ // Split the styles into three groups
 2575+ $styles = array( 'other' => array(), 'user' => array(), 'site' => array() );
 2576+ $resourceLoader = $this->getResourceLoader();
 2577+ foreach ( $this->getModuleStyles() as $name ) {
 2578+ $group = $resourceLoader->getModule( $name )->getGroup();
 2579+ // Modules in groups named "other" or anything different than "user" or "site" will
 2580+ // be placed in the "other" group
 2581+ $styles[isset( $style[$group] ) ? $group : 'other'][] = $name;
 2582+ }
 2583+ // Add styles to tags, user modules last
 2584+ $tags[] = $this->makeResourceLoaderLink(
 2585+ $sk, array_merge( $styles['other'], $styles['site'], $styles['user'] ), 'styles'
 2586+ );
25742587 return implode( "\n", $tags );
25752588 }
25762589
@@ -2627,23 +2640,8 @@
26282641 * Build a set of <link>s for the stylesheets specified in the $this->styles array.
26292642 * These will be applied to various media & IE conditionals.
26302643 */
2631 - public function buildCssLinks( $sk ) {
2632 - // Split the styles into three groups
2633 - $styles = array( 'other' => array(), 'user' => array(), 'site' => array() );
2634 - $resourceLoader = $this->getResourceLoader();
2635 - foreach ( $this->getModuleStyles() as $name ) {
2636 - $group = $resourceLoader->getModule( $name )->getGroup();
2637 - // Modules in groups named "other" or anything different than "user" or "site" will
2638 - // be placed in the "other" group
2639 - $styles[isset( $styles[$group] ) ? $group : 'other'][] = $name;
2640 - }
2641 - // Add tags created using legacy methods
2642 - $tags = $this->buildCssLinksArray();
2643 - // Add ResourceLoader module style tags
2644 - $tags[] = $this->makeResourceLoaderLink(
2645 - $sk, array_merge( $styles['other'], $styles['site'], $styles['user'] ), 'styles'
2646 - );
2647 - return implode( "\n", $tags );
 2644+ public function buildCssLinks() {
 2645+ return implode( "\n", $this->buildCssLinksArray() );
26482646 }
26492647
26502648 public function buildCssLinksArray() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r78934Followup r78933: reapply r78802catrope23:28, 23 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78023Improves on r77693 by placing ResourceLoader "only styles" CSS links together...tparscal22:27, 7 December 2010
r78802Followup r78023, change usage of $style to $styles, not introduced in this re...reedy16:16, 22 December 2010

Status & tagging log