hierarchicalize(!) stat names
[lhc/web/wiklou.git] / includes / OutputPage.php
index 770cf47..ba9fcba 100644 (file)
@@ -591,6 +591,19 @@ class OutputPage extends ContextSource {
         * @return array Array of module names
         */
        public function getModuleStyles( $filter = false, $position = null ) {
+               // T97420
+               $resourceLoader = $this->getResourceLoader();
+
+               foreach ( $this->mModuleStyles as $val ) {
+                       $module = $resourceLoader->getModule( $val );
+
+                       if ( $module instanceof ResourceLoaderModule && $module->isPositionDefault() ) {
+                               $warning = __METHOD__ . ': style module should define its position explicitly: ' . $val . ' ' . get_class( $module );
+                               wfDebugLog( 'resourceloader', $warning );
+                               wfLogWarning( $warning );
+                       }
+               }
+
                return $this->getModules( $filter, $position, 'mModuleStyles' );
        }
 
@@ -2968,8 +2981,10 @@ class OutputPage extends ContextSource {
                // Load embeddable private modules before any loader links
                // This needs to be TYPE_COMBINED so these modules are properly wrapped
                // in mw.loader.implement() calls and deferred until mw.user is available
-               $embedScripts = array( 'user.options', 'user.tokens' );
+               $embedScripts = array( 'user.options' );
                $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
+               // Separate user.tokens as otherwise caching will be allowed (T84960)
+               $links[] = $this->makeResourceLoaderLink( 'user.tokens', ResourceLoaderModule::TYPE_COMBINED );
 
                // Scripts and messages "only" requests marked for top inclusion
                $links[] = $this->makeResourceLoaderLink(
@@ -3008,11 +3023,17 @@ class OutputPage extends ContextSource {
                // Scripts "only" requests marked for bottom inclusion
                // If we're in the <head>, use load() calls rather than <script src="..."> tags
                $links = array();
+
                $links[] = $this->makeResourceLoaderLink( $this->getModuleScripts( true, 'bottom' ),
                        ResourceLoaderModule::TYPE_SCRIPTS, /* $useESI = */ false, /* $extraQuery = */ array(),
                        /* $loadCall = */ $inHead
                );
 
+               $links[] = $this->makeResourceLoaderLink( $this->getModuleStyles( true, 'bottom' ),
+                       ResourceLoaderModule::TYPE_STYLES, /* $useESI = */ false, /* $extraQuery = */ array(),
+                       /* $loadCall = */ $inHead
+               );
+
                // Modules requests - let the client calculate dependencies and batch requests as it likes
                // Only load modules that have marked themselves for loading at the bottom
                $modules = $this->getModules( true, 'bottom' );
@@ -3070,6 +3091,9 @@ class OutputPage extends ContextSource {
         * @return string
         */
        function getBottomScripts() {
+               // In case the skin wants to add bottom CSS
+               $this->getSkin()->setupSkinUserCss( $this );
+
                // Optimise jQuery ready event cross-browser.
                // This also enforces $.isReady to be true at </body> which fixes the
                // mw.loader bug in Firefox with using document.write between </body>
@@ -3581,7 +3605,7 @@ class OutputPage extends ContextSource {
                $otherTags = ''; // Tags to append after the normal <link> tags
                $resourceLoader = $this->getResourceLoader();
 
-               $moduleStyles = $this->getModuleStyles();
+               $moduleStyles = $this->getModuleStyles( true, 'top' );
 
                // Per-site custom styles
                $moduleStyles[] = 'site';