jenkins-bot has submitted this change and it was merged.

Change subject: Adjust $wgLoadScript adjustment
......................................................................


Adjust $wgLoadScript adjustment

Change-Id: I3499b3ae9a293ce03ecaf299c4ede2b576e6eea9
---
M wmf-config/mobile.php
1 file changed, 20 insertions(+), 27 deletions(-)

Approvals:
  MaxSem: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wmf-config/mobile.php b/wmf-config/mobile.php
index 22f4535..8859c30 100644
--- a/wmf-config/mobile.php
+++ b/wmf-config/mobile.php
@@ -115,6 +115,26 @@
                }
                $wgMFCustomLogos = $wmgMFCustomLogos;
        }
+
+       // Point mobile load.php requests to a special path on bits that gets 
X-Device headers
+       function wmfSetupMobileLoadScript() {
+               global $wgDBname, $wgLoadScript;
+
+               if ( MobileContext::singleton()->shouldDisplayMobileView()
+               if ( $wgDBname === 'testwiki' ) {
+                       // testwiki's resources aren't loaded from bits, it 
just needs a mobile domain
+                       $wgLoadScript = '//test.m.wikipedia.org/w/load.php';
+               } else {
+                       $wgLoadScript = str_replace( 'bits.wikimedia.org/', 
'bits.wikimedia.org/m/', $wgLoadScript );
+               }
+       }
+
+       // Enable $wgMFVaryResources only if there's a mobile site (otherwise 
we'll end up
+       // looking for X-WAP headers in requests coming from Squid
+       if ( $wmgMFVaryResources && $wgMobileUrlTemplate !== '' ) {
+               $wgMFVaryResources = true;
+               $wgExtensionFunctions[] = 'wmfSetupMobileLoadScript';
+       }
 }
 
 
@@ -180,30 +200,3 @@
 // Enable X-Analytics logging
 $wgMFEnableXAnalyticsLogging = $wmgMFEnableXAnalyticsLogging;
 
-function wfAdjustLoadScript() {
-       global $wgDBname, $wgLoadScript;
-       if ( $wgDBname === 'testwiki' ) {
-               // testwiki's resources aren't loaded from bits, it just needs 
a mobile domain
-               $wgLoadScript = '//test.m.wikipedia.org/w/load.php';
-       } else {
-               $wgLoadScript = str_replace( 'bits.wikimedia.org/', 
'bits.wikimedia.org/m/', $wgLoadScript );
-       }
-}
-
-// Enable $wgMFVaryResources only if there's a mobile site (otherwise we'll 
end up
-// looking for X-WAP headers in requests coming from Squid
-if ( $wmgMFVaryResources && $wgMobileUrlTemplate !== '' ) {
-       $wgMFVaryResources = true;
-       // Point mobile load.php requests to a special path on bits that gets 
X-Device headers
-       $wgHooks['EnterMobileMode'][] = function() {
-               wfAdjustLoadScript();
-               return true;
-       };
-       // Force an update early in startup module initialization
-       $wgHooks['ResourceLoaderGetStartupModules'][] = function() {
-               if ( MobileContext::singleton()->shouldDisplayMobileView() ) {
-                       wfAdjustLoadScript();
-               }
-               return true;
-       };
-}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3499b3ae9a293ce03ecaf299c4ede2b576e6eea9
Gerrit-PatchSet: 3
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to