jenkins-bot has submitted this change and it was merged.
Change subject: Tweak wgLoadScript in startup module
......................................................................
Tweak wgLoadScript in startup module
Change-Id: Ibd3aade29165f9d151077e85d439ba091bc2e6e9
---
M wmf-config/mobile.php
1 file changed, 17 insertions(+), 6 deletions(-)
Approvals:
MaxSem: Verified; Looks good to me, approved
awjrichards: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/wmf-config/mobile.php b/wmf-config/mobile.php
index 18db4a9..22f4535 100644
--- a/wmf-config/mobile.php
+++ b/wmf-config/mobile.php
@@ -180,18 +180,29 @@
// 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() {
- 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 );
+ 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/59767
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd3aade29165f9d151077e85d439ba091bc2e6e9
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits