r114413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114412‎ | r114413 | r114414 >
Date:21:51, 21 March 2012
Author:awjrichards
Status:deferred
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php
@@ -1483,7 +1483,7 @@
14841484 }
14851485
14861486 public function checkUseFormatCookie() {
1487 - global $wgRequest, $wgCookiePrefix;
 1487+ global $wgRequest, $wgCookiePrefix, $wgScriptPath;
14881488
14891489 if ( !isset( self::$useFormatCookieName )) {
14901490 self::$useFormatCookieName = $wgCookiePrefix . 'mf_useformat';
@@ -1497,9 +1497,15 @@
14981498 $this->setUseFormat( $useFormatFromCookie );
14991499 }
15001500
1501 - // set appropriate cookie if necessary
1502 - if ( ( $useFormatFromCookie != 'mobile' && $useFormat == 'mobile' ) ||
1503 - ( $useFormatFromCookie != 'desktop' && $useFormat == 'desktop' ) ) {
 1501+ // set appropriate cookie if necessary, ignoring certain URL patterns
 1502+ // eg initial requests to a mobile-specific domain with no path. this
 1503+ // is intended to avoid pitfalls for certain server configurations
 1504+ // but should not get in the way of out-of-the-box configs
 1505+ $reqUrl = $wgRequest->getRequestUrl();
 1506+ $urlsToIgnore = array( '/?useformat=mobile', $wgScriptPath . '/?useformat=mobile' );
 1507+ if ( ( ( $useFormatFromCookie != 'mobile' && $useFormat == 'mobile' ) ||
 1508+ ( $useFormatFromCookie != 'desktop' && $useFormat == 'desktop' ) ) &&
 1509+ !in_array( $reqUrl, $urlsToIgnore ) ) {
15041510 $this->setUseFormatCookie( $useFormat );
15051511 }
15061512 }
Property changes on: branches/wmf/1.19wmf1/extensions/MobileFrontend
___________________________________________________________________
Modified: svn:mergeinfo
15071513 Merged /trunk/extensions/MobileFrontend:r114409

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r114409No longer setting useformat cookie if URL = "/?useformat=mobile" or "$wgScrip...awjrichards21:36, 21 March 2012

Status & tagging log