Index: branches/Gadgets-work/Gadgets_body.php |
— | — | @@ -102,8 +102,10 @@ |
103 | 103 | */ |
104 | 104 | public static function beforePageDisplay( $out ) { |
105 | 105 | global $wgUser; |
| 106 | + |
106 | 107 | if ( !$wgUser->isLoggedIn() ) return true; |
107 | 108 | |
| 109 | + wfProfileIn( __METHOD__ ); |
108 | 110 | //disable all gadgets on critical special pages |
109 | 111 | //NOTE: $out->isUserJsAllowed() is tempting, but always fals if $wgAllowUserJs is false. |
110 | 112 | // That would disable gadgets on wikis without user JS. Introducing $out->isJsAllowed() |
— | — | @@ -112,12 +114,17 @@ |
113 | 115 | $title = $out->getTitle(); |
114 | 116 | if ( $title->isSpecial( 'Preferences' ) |
115 | 117 | || $title->isSpecial( 'Resetpass' ) |
116 | | - || $title->isSpecial( 'Userlogin' ) ) { |
| 118 | + || $title->isSpecial( 'Userlogin' ) ) |
| 119 | + { |
| 120 | + wfProfileOut( __METHOD__ ); |
117 | 121 | return true; |
118 | 122 | } |
119 | 123 | |
120 | 124 | $gadgets = Gadget::loadList(); |
121 | | - if ( !$gadgets ) return true; |
| 125 | + if ( !$gadgets ) { |
| 126 | + wfProfileOut( __METHOD__ ); |
| 127 | + return true; |
| 128 | + } |
122 | 129 | |
123 | 130 | $lb = new LinkBatch(); |
124 | 131 | $lb->setCaller( __METHOD__ ); |
— | — | @@ -143,6 +150,7 @@ |
144 | 151 | $done[$page] = true; |
145 | 152 | self::applyScript( $page, $out ); |
146 | 153 | } |
| 154 | + wfProfileOut( __METHOD__ ); |
147 | 155 | |
148 | 156 | return true; |
149 | 157 | } |
— | — | @@ -338,6 +346,7 @@ |
339 | 347 | |
340 | 348 | if ( $gadgets !== null ) return $gadgets; |
341 | 349 | |
| 350 | + wfProfileIn( __METHOD__ ); |
342 | 351 | $struct = self::loadStructuredList(); |
343 | 352 | if ( !$struct ) { |
344 | 353 | $gadgets = $struct; |
— | — | @@ -348,6 +357,7 @@ |
349 | 358 | foreach ( $struct as $section => $entries ) { |
350 | 359 | $gadgets = array_merge( $gadgets, $entries ); |
351 | 360 | } |
| 361 | + wfProfileOut( __METHOD__ ); |
352 | 362 | |
353 | 363 | return $gadgets; |
354 | 364 | } |
— | — | @@ -386,16 +396,21 @@ |
387 | 397 | static $gadgets = null; |
388 | 398 | if ( $gadgets !== null && $forceNewText === null ) return $gadgets; |
389 | 399 | |
| 400 | + wfProfileIn( __METHOD__ ); |
390 | 401 | $key = wfMemcKey( 'gadgets-definition' ); |
391 | 402 | |
392 | 403 | if ( $forceNewText === null ) { |
393 | 404 | //cached? |
394 | 405 | $gadgets = $wgMemc->get( $key ); |
395 | | - if ( self::isValidList( $gadgets ) ) return $gadgets; |
| 406 | + if ( self::isValidList( $gadgets ) ) { |
| 407 | + wfProfileOut( __METHOD__ ); |
| 408 | + return $gadgets; |
| 409 | + } |
396 | 410 | |
397 | 411 | $g = wfMsgForContentNoTrans( "gadgets-definition" ); |
398 | 412 | if ( wfEmptyMsg( "gadgets-definition", $g ) ) { |
399 | 413 | $gadgets = false; |
| 414 | + wfProfileOut( __METHOD__ ); |
400 | 415 | return $gadgets; |
401 | 416 | } |
402 | 417 | } else { |
— | — | @@ -424,6 +439,7 @@ |
425 | 440 | $wgMemc->set( $key, $gadgets, 60*60*24 ); |
426 | 441 | $source = $forceNewText !== null ? 'input text' : 'MediaWiki:Gadgets-definition'; |
427 | 442 | wfDebug( __METHOD__ . ": $source parsed, cache entry $key updated\n"); |
| 443 | + wfProfileOut( __METHOD__ ); |
428 | 444 | |
429 | 445 | return $gadgets; |
430 | 446 | } |