resourceloader: Remove styles from 'site', depend on 'site.styles'
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 6 Jun 2016 18:21:36 +0000 (19:21 +0100)
committerKrinkle <krinklemail@gmail.com>
Tue, 26 Jul 2016 23:13:03 +0000 (23:13 +0000)
For legacy reasons, the site module has always been both a script
module and a page-style module at the same time. Meaning, the styles
and scripts portion of it don't directly relate to each other, rather
they both relate to the page directly. As such, they should be
loaded separately.

Loading it as a dynamic module is not an option as its styles should
be top-loaded and not depend on JavaScript. The restriction that
will be put it place for T92459 also requires the module be split.

For environments that use static file or proxy caching, this MUST
be deployed after Ic137cb494 and I8b6c6a1 have been deployed and all
cache has rolled over.

Bug: T92459
Bug: T108590
Change-Id: Id2342454bdc87a7c4d194f7350caa699ec4054b9

includes/resourceloader/ResourceLoaderSiteModule.php

index e01d0a1..7401d58 100644 (file)
@@ -39,12 +39,13 @@ class ResourceLoaderSiteModule extends ResourceLoaderWikiModule {
                        $pages['MediaWiki:Common.js'] = [ 'type' => 'script' ];
                        $pages['MediaWiki:' . ucfirst( $context->getSkin() ) . '.js'] = [ 'type' => 'script' ];
                }
-               if ( $this->getConfig()->get( 'UseSiteCss' ) ) {
-                       $pages['MediaWiki:Common.css'] = [ 'type' => 'style' ];
-                       $pages['MediaWiki:' . ucfirst( $context->getSkin() ) . '.css'] = [ 'type' => 'style' ];
-                       $pages['MediaWiki:Print.css'] = [ 'type' => 'style', 'media' => 'print' ];
-
-               }
                return $pages;
        }
+
+       /*
+        * @return array
+        */
+       public function getDependencies( ResourceLoaderContext $context = null ) {
+               return [ 'site.styles' ];
+       }
 }