r109589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109588‎ | r109589 | r109590 >
Date:00:05, 20 January 2012
Author:preilly
Status:ok
Tags:
Comment:
do not call WURFL if not mobile request
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -496,6 +496,28 @@
497497 global $wgContLang, $wgRequest, $wgMemc, $wgUser, $wgConf;
498498 wfProfileIn( __METHOD__ );
499499
 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+
500522 $userAgent = $_SERVER['HTTP_USER_AGENT'];
501523 $acceptHeader = isset( $_SERVER["HTTP_ACCEPT"] ) ? $_SERVER["HTTP_ACCEPT"] : '';
502524 $uAmd5 = md5( $userAgent );
@@ -524,28 +546,6 @@
525547 // echo $e->getMessage();
526548 }
527549
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 -
550550 self::$title = $out->getTitle();
551551
552552 if ( self::$title->isMainPage() ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r1095901.18wmf: MFT r109589preilly00:07, 20 January 2012

Status & tagging log