Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php |
— | — | @@ -1457,7 +1457,7 @@ |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | public function checkUseFormatCookie() { |
1461 | | - global $wgRequest, $wgCookiePrefix; |
| 1461 | + global $wgRequest, $wgCookiePrefix, $wgScriptPath; |
1462 | 1462 | |
1463 | 1463 | if ( !isset( self::$useFormatCookieName )) { |
1464 | 1464 | self::$useFormatCookieName = $wgCookiePrefix . 'mf_useformat'; |
— | — | @@ -1471,9 +1471,15 @@ |
1472 | 1472 | $this->setUseFormat( $useFormatFromCookie ); |
1473 | 1473 | } |
1474 | 1474 | |
1475 | | - // set appropriate cookie if necessary |
1476 | | - if ( ( $useFormatFromCookie != 'mobile' && $useFormat == 'mobile' ) || |
1477 | | - ( $useFormatFromCookie != 'desktop' && $useFormat == 'desktop' ) ) { |
| 1475 | + // set appropriate cookie if necessary, ignoring certain URL patterns |
| 1476 | + // eg initial requests to a mobile-specific domain with no path. this |
| 1477 | + // is intended to avoid pitfalls for certain server configurations |
| 1478 | + // but should not get in the way of out-of-the-box configs |
| 1479 | + $reqUrl = $wgRequest->getRequestUrl(); |
| 1480 | + $urlsToIgnore = array( '/?useformat=mobile', $wgScriptPath . '/?useformat=mobile' ); |
| 1481 | + if ( ( ( $useFormatFromCookie != 'mobile' && $useFormat == 'mobile' ) || |
| 1482 | + ( $useFormatFromCookie != 'desktop' && $useFormat == 'desktop' ) ) && |
| 1483 | + !in_array( $reqUrl, $urlsToIgnore ) ) { |
1478 | 1484 | $this->setUseFormatCookie( $useFormat ); |
1479 | 1485 | } |
1480 | 1486 | } |