https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114413

Revision: 114413
Author:   awjrichards
Date:     2012-03-21 21:51:47 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
MFT r114409

Modified Paths:
--------------
    branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php

Property Changed:
----------------
    branches/wmf/1.19wmf1/extensions/MobileFrontend/


Property changes on: branches/wmf/1.19wmf1/extensions/MobileFrontend
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/extensions/MobileFrontend:99727,114313,114315,114319,114341,114384
   + 
/trunk/extensions/MobileFrontend:99727,114313,114315,114319,114341,114384,114409

Modified: 
branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php     
2012-03-21 21:42:17 UTC (rev 114412)
+++ branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php     
2012-03-21 21:51:47 UTC (rev 114413)
@@ -1483,7 +1483,7 @@
        }
        
        public function checkUseFormatCookie() {
-               global $wgRequest, $wgCookiePrefix;
+               global $wgRequest, $wgCookiePrefix, $wgScriptPath;
                
                if ( !isset( self::$useFormatCookieName )) {
                        self::$useFormatCookieName = $wgCookiePrefix . 
'mf_useformat';
@@ -1497,9 +1497,15 @@
                        $this->setUseFormat( $useFormatFromCookie );
                }
                
-               // set appropriate cookie if necessary
-               if ( ( $useFormatFromCookie != 'mobile' && $useFormat == 
'mobile' ) ||
-                               ( $useFormatFromCookie != 'desktop' && 
$useFormat == 'desktop' ) ) {
+               // set appropriate cookie if necessary, ignoring certain URL 
patterns
+               // eg initial requests to a mobile-specific domain with no 
path. this 
+               // is intended to avoid pitfalls for certain server 
configurations
+               // but should not get in the way of out-of-the-box configs
+               $reqUrl = $wgRequest->getRequestUrl();
+               $urlsToIgnore = array( '/?useformat=mobile', $wgScriptPath . 
'/?useformat=mobile' );
+               if ( ( ( $useFormatFromCookie != 'mobile' && $useFormat == 
'mobile' ) ||
+                               ( $useFormatFromCookie != 'desktop' && 
$useFormat == 'desktop' ) ) &&
+                               !in_array( $reqUrl, $urlsToIgnore ) ) {
                        $this->setUseFormatCookie( $useFormat );
                }
        }


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

Reply via email to