Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/141284

Change subject: Use new OutputPageScriptsForBottomQueue hook
......................................................................

Use new OutputPageScriptsForBottomQueue hook

Bug: 62602
Change-Id: Ie70903f0491c76ee776518d8268e5a3e351daec7
Depends-On: Ifccac7889e80b2f674cd54bb4ad3e53c6aa1dfa1
---
M GlobalCssJs.hooks.php
M GlobalCssJs.php
2 files changed, 13 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalCssJs 
refs/changes/84/141284/1

diff --git a/GlobalCssJs.hooks.php b/GlobalCssJs.hooks.php
index 5077b67..f99d64a 100644
--- a/GlobalCssJs.hooks.php
+++ b/GlobalCssJs.hooks.php
@@ -3,28 +3,24 @@
 class GlobalCssJsHooks {
 
        /**
-        * @param &$out OutputPage
-        * @param &$skin Skin
+        * @param OutputPage $out
+        * @param array $links
+        * @param bool $inHead
         * @return bool
         */
-       static function onBeforePageDisplay( &$out, &$skin ) {
-               global $wgGlobalCssJsConfig, $wgUseGlobalSiteCssJs;
+       static function onOutputPageScriptsForBottomQueue( OutputPage $out, 
array &$links, $inHead ) {
+               global $wgUseGlobalSiteCssJs;
 
                if ( $wgUseGlobalSiteCssJs ) {
-                       // Global site modules are loaded for everyone, if 
enabled
-                       $out->addModules( 'ext.globalCssJs.site' );
+                       $links[] = $out->makeResourceLoaderLink( 
'ext.globalCssJs.site', ResourceLoaderModule::TYPE_COMBINED,
+                               /* $useESI = */ false, /* $extraQuery = */ 
array(), /* $loadCall = */ $inHead
+                       );
                }
 
-               $user = $out->getUser();
-               // Only load user modules for logged in users
-               if ( $user->isAnon() ) {
-                       return true;
-               }
-
-               // If we are on a different site, use a hook to allow other 
extensions
-               // like CentralAuth verify that the same account exists on both 
sites
-               if ( self::loadForUser( $user ) ) {
-                       $out->addModules( 'ext.globalCssJs.user' );
+               if ( !$out->getUser()->isAnon() && self::loadForUser( 
$out->getUser() ) ) {
+                       $links[] = $out->makeResourceLoaderLink( 
'ext.globalCssJs.user', ResourceLoaderModule::TYPE_COMBINED,
+                               /* $useESI = */ false, /* $extraQuery = */ 
array(), /* $loadCall = */ $inHead
+                       );
                }
 
                return true;
diff --git a/GlobalCssJs.php b/GlobalCssJs.php
index c3f00da..8a0f105 100644
--- a/GlobalCssJs.php
+++ b/GlobalCssJs.php
@@ -60,7 +60,7 @@
        }
 };
 
-$wgHooks['BeforePageDisplay'][] = 'GlobalCssJsHooks::onBeforePageDisplay';
+$wgHooks['OutputPageScriptsForBottomQueue'][] = 
'GlobalCssJsHooks::onOutputPageScriptsForBottomQueue';
 $wgHooks['ResourceLoaderRegisterModules'][] = 
'GlobalCssJsHooks::onResourceLoaderRegisterModules';
 $wgHooks['EditPage::showEditForm:initial'][] = 
'GlobalCssJsHooks::onEditPageshowEditForminitial';
 $wgHooks['GetPreferences'][] = 'GlobalCssJsHooks::onGetPreferences';

-- 
To view, visit https://gerrit.wikimedia.org/r/141284
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie70903f0491c76ee776518d8268e5a3e351daec7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalCssJs
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to