jenkins-bot has submitted this change and it was merged. Change subject: Add variable to disable WAP ......................................................................
Add variable to disable WAP Change-Id: I429484b9687ff09ce43eae3d89b6d7c91338ea99 --- M MobileFrontend.php M includes/MobileFrontend.hooks.php M includes/formatters/MobileFormatter.php M includes/skins/SkinMinerva.php 4 files changed, 23 insertions(+), 4 deletions(-) Approvals: Dr0ptp4kt: Looks good to me, but someone else must approve Jdlrobson: Looks good to me, approved Yurik: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/MobileFrontend.php b/MobileFrontend.php index 7d9850b..701b21c 100644 --- a/MobileFrontend.php +++ b/MobileFrontend.php @@ -449,3 +449,16 @@ * Controls whether API action=mobileview should have every HTML section tidied for invalid markup */ $wgMFTidyMobileViewSections = true; + +/** + * Controls the use of WAP view. Possible values: + * enabled - WAP is enabled; + * transitional - disabled but output still varied by X-WAP and requests with X-WAP: yes have shorter expiry time; + * disabled - WAP is disabled; + */ +$wgMFWap = 'enabled'; + +/** + * Maximum HTTP lifetime for page views with $wgMFWap = 'transitional' + */ +$wgMFTransitionalWapLifetime = 3 * 86400; diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index 9bd19e3..35da4ee 100644 --- a/includes/MobileFrontend.hooks.php +++ b/includes/MobileFrontend.hooks.php @@ -41,7 +41,7 @@ * @return bool */ public static function onRequestContextCreateSkin( $context, &$skin ) { - global $wgMFEnableDesktopResources, $wgMFDefaultSkinClass, $wgULSPosition; + global $wgMFEnableDesktopResources, $wgMFDefaultSkinClass, $wgULSPosition, $wgMFWap; // check whether or not the user has requested to toggle their view $mobileContext = MobileContext::singleton(); @@ -78,7 +78,7 @@ // log whether user is using alpha/beta/stable $mobileContext->logMobileMode(); - if ( $mobileContext->getContentFormat() == 'WML' ) { + if ( $mobileContext->getContentFormat() == 'WML' && $wgMFWap == 'enabled' ) { # Grab the skin class and initialise it. $skin = new SkinMobileWML( $context ); } else { diff --git a/includes/formatters/MobileFormatter.php b/includes/formatters/MobileFormatter.php index 4bb2304..314d371 100644 --- a/includes/formatters/MobileFormatter.php +++ b/includes/formatters/MobileFormatter.php @@ -48,6 +48,8 @@ * @return MobileFormatter */ public static function newFromContext( $context, $html ) { + global $wgMFWap; + wfProfileIn( __METHOD__ ); $title = $context->getTitle(); @@ -56,7 +58,7 @@ $isSpecialPage = $title->isSpecialPage(); $html = self::wrapHTML( $html ); - if ( $context->getContentFormat() === 'WML' ) { + if ( $context->getContentFormat() === 'WML' && $wgMFWap === 'enabled' ) { $wmlContext = new WmlContext( $context ); $formatter = new MobileFormatterWML( $html, $title, $wmlContext ); } else { diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index 5e339b0..1c646c5 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -706,13 +706,17 @@ // public function outputMobilePage() { - global $wgMFNoindexPages; + global $wgMFNoindexPages, $wgMFWap, $wgMFTransitionalWapLifetime; wfProfileIn( __METHOD__ ); $out = $this->getOutput(); $out->setTarget( 'mobile' ); if ( $out && $wgMFNoindexPages ) { $out->setRobotPolicy( 'noindex,nofollow' ); } + # Restrict cache lifetime for potentially WAPy requests during the transitional period + if ( $wgMFWap == 'transitional' && $this->getRequest()->getText( 'X-WAP' ) == 'yes' ) { + $out->setSquidMaxage( min( $out->mSquidMaxage, $wgMFTransitionalWapLifetime ) ); + } wfRunHooks( 'BeforePageDisplayMobile', array( &$out ) ); parent::outputPage(); -- To view, visit https://gerrit.wikimedia.org/r/103658 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I429484b9687ff09ce43eae3d89b6d7c91338ea99 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Dr0ptp4kt <ab...@wikimedia.org> Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Yurik <yu...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits