MaxSem has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59810
Change subject: Adjust $wgLoadScript adjustment
......................................................................
Adjust $wgLoadScript adjustment
Change-Id: I3499b3ae9a293ce03ecaf299c4ede2b576e6eea9
---
M wmf-config/mobile.php
1 file changed, 21 insertions(+), 27 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/10/59810/1
diff --git a/wmf-config/mobile.php b/wmf-config/mobile.php
index 22f4535..32b1b47 100644
--- a/wmf-config/mobile.php
+++ b/wmf-config/mobile.php
@@ -115,6 +115,27 @@
}
$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 );
+ }
+ return true;
+ }
+
+ // 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 +201,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: newchange
Gerrit-Change-Id: I3499b3ae9a293ce03ecaf299c4ede2b576e6eea9
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits