Index: trunk/extensions/MobileFrontend/MobileFrontend.php |
— | — | @@ -496,6 +496,28 @@ |
497 | 497 | global $wgContLang, $wgRequest, $wgMemc, $wgUser, $wgConf; |
498 | 498 | wfProfileIn( __METHOD__ ); |
499 | 499 | |
| 500 | + // Note: The WebRequest Class calls are made in this block because |
| 501 | + // since PHP 5.1.x, all objects have their destructors called |
| 502 | + // before the output buffer callback function executes. |
| 503 | + // Thus, globalized objects will not be available as expected in the function. |
| 504 | + // This is stated to be intended behavior, as per the following: [http://bugs.php.net/bug.php?id=40104] |
| 505 | + |
| 506 | + $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : ''; |
| 507 | + self::$useFormat = $wgRequest->getText( 'useformat' ); |
| 508 | + $mobileAction = $wgRequest->getText( 'mobileaction' ); |
| 509 | + $action = $wgRequest->getText( 'action' ); |
| 510 | + |
| 511 | + if ( self::$useFormat !== 'mobile' && self::$useFormat !== 'mobile-wap' && |
| 512 | + !$xDevice ) { |
| 513 | + wfProfileOut( __METHOD__ ); |
| 514 | + return true; |
| 515 | + } |
| 516 | + if ( $action === 'edit' || |
| 517 | + $mobileAction === 'view_normal_site' ) { |
| 518 | + wfProfileOut( __METHOD__ ); |
| 519 | + return true; |
| 520 | + } |
| 521 | + |
500 | 522 | $userAgent = $_SERVER['HTTP_USER_AGENT']; |
501 | 523 | $acceptHeader = isset( $_SERVER["HTTP_ACCEPT"] ) ? $_SERVER["HTTP_ACCEPT"] : ''; |
502 | 524 | $uAmd5 = md5( $userAgent ); |
— | — | @@ -524,28 +546,6 @@ |
525 | 547 | // echo $e->getMessage(); |
526 | 548 | } |
527 | 549 | |
528 | | - // Note: The WebRequest Class calls are made in this block because |
529 | | - // since PHP 5.1.x, all objects have their destructors called |
530 | | - // before the output buffer callback function executes. |
531 | | - // Thus, globalized objects will not be available as expected in the function. |
532 | | - // This is stated to be intended behavior, as per the following: [http://bugs.php.net/bug.php?id=40104] |
533 | | - |
534 | | - $xDevice = isset( $_SERVER['HTTP_X_DEVICE'] ) ? $_SERVER['HTTP_X_DEVICE'] : ''; |
535 | | - self::$useFormat = $wgRequest->getText( 'useformat' ); |
536 | | - $mobileAction = $wgRequest->getText( 'mobileaction' ); |
537 | | - $action = $wgRequest->getText( 'action' ); |
538 | | - |
539 | | - if ( self::$useFormat !== 'mobile' && self::$useFormat !== 'mobile-wap' && |
540 | | - !$xDevice ) { |
541 | | - wfProfileOut( __METHOD__ ); |
542 | | - return true; |
543 | | - } |
544 | | - if ( $action === 'edit' || |
545 | | - $mobileAction === 'view_normal_site' ) { |
546 | | - wfProfileOut( __METHOD__ ); |
547 | | - return true; |
548 | | - } |
549 | | - |
550 | 550 | self::$title = $out->getTitle(); |
551 | 551 | |
552 | 552 | if ( self::$title->isMainPage() ) { |