Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -13,20 +13,22 @@ |
14 | 14 | private $context; |
15 | 15 | |
16 | 16 | public function request( WebRequest $x = null ){ |
| 17 | + $old = $this->context->getRequest(); |
17 | 18 | $this->context->setRequest( $x ); |
18 | | - return $this->context->getRequest(); |
| 19 | + return $old; |
19 | 20 | } |
20 | 21 | |
21 | 22 | public function output( OutputPage $x = null ){ |
| 23 | + $old = $this->context->getOutput(); |
22 | 24 | $this->context->setOutput( $x ); |
23 | | - return $this->context->getOutput(); |
| 25 | + return $old; |
24 | 26 | } |
25 | 27 | |
26 | 28 | public function __construct( RequestContext $context = null ) { |
27 | 29 | if ( !$context ) { |
28 | 30 | $context = RequestContext::getMain(); |
29 | 31 | } |
30 | | - |
| 32 | + |
31 | 33 | $this->context = $context; |
32 | 34 | $this->context->setTitle( $this->parseTitle() ); |
33 | 35 | } |
— | — | @@ -205,7 +207,7 @@ |
206 | 208 | */ |
207 | 209 | global $wgArticle; |
208 | 210 | $wgArticle = $article; |
209 | | - |
| 211 | + |
210 | 212 | $this->performAction( $article ); |
211 | 213 | wfProfileOut( __METHOD__ ); |
212 | 214 | return $article; |
— | — | @@ -487,8 +489,8 @@ |
488 | 490 | |
489 | 491 | /** |
490 | 492 | * Run the current MediaWiki instance |
491 | | - * index.php just calls this |
492 | | - */ |
| 493 | + * index.php just calls this |
| 494 | + */ |
493 | 495 | function run() { |
494 | 496 | try { |
495 | 497 | $this->checkMaxLag( true ); |
— | — | @@ -497,19 +499,19 @@ |
498 | 500 | } catch ( Exception $e ) { |
499 | 501 | MWExceptionHandler::handle( $e ); |
500 | 502 | } |
501 | | - } |
502 | | - |
| 503 | + } |
| 504 | + |
503 | 505 | /** |
504 | | - * Checks if the request should abort due to a lagged server, |
| 506 | + * Checks if the request should abort due to a lagged server, |
505 | 507 | * for given maxlag parameter. |
506 | | - * |
507 | | - * @param boolean $abort True if this class should abort the |
| 508 | + * |
| 509 | + * @param boolean $abort True if this class should abort the |
508 | 510 | * script execution. False to return the result as a boolean. |
509 | 511 | * @return boolean True if we passed the check, false if we surpass the maxlag |
510 | 512 | */ |
511 | 513 | function checkMaxLag( $abort ) { |
512 | 514 | global $wgShowHostnames; |
513 | | - |
| 515 | + |
514 | 516 | wfProfileIn( __METHOD__ ); |
515 | 517 | $maxLag = $this->context->getRequest()->getVal( 'maxlag' ); |
516 | 518 | if ( !is_null( $maxLag ) ) { |
— | — | @@ -527,10 +529,10 @@ |
528 | 530 | echo "Waiting for a database server: $lag seconds lagged\n"; |
529 | 531 | } |
530 | 532 | } |
531 | | - |
| 533 | + |
532 | 534 | wfProfileOut( __METHOD__ ); |
533 | 535 | |
534 | | - if ( !$abort ) |
| 536 | + if ( !$abort ) |
535 | 537 | return false; |
536 | 538 | exit; |
537 | 539 | } |
— | — | @@ -541,13 +543,13 @@ |
542 | 544 | |
543 | 545 | function main() { |
544 | 546 | global $wgUseFileCache, $wgTitle, $wgUseAjax; |
545 | | - |
| 547 | + |
546 | 548 | wfProfileIn( __METHOD__ ); |
547 | | - |
| 549 | + |
548 | 550 | # Set title from request parameters |
549 | 551 | $wgTitle = $this->getTitle(); |
550 | 552 | $action = $this->getAction(); |
551 | | - |
| 553 | + |
552 | 554 | # Send Ajax requests to the Ajax dispatcher. |
553 | 555 | if ( $wgUseAjax && $action == 'ajax' ) { |
554 | 556 | $dispatcher = new AjaxDispatcher(); |
— | — | @@ -555,7 +557,7 @@ |
556 | 558 | wfProfileOut( __METHOD__ ); |
557 | 559 | return; |
558 | 560 | } |
559 | | - |
| 561 | + |
560 | 562 | if ( $wgUseFileCache && $wgTitle !== null ) { |
561 | 563 | wfProfileIn( 'main-try-filecache' ); |
562 | 564 | // Raw pages should handle cache control on their own, |
— | — | @@ -580,10 +582,10 @@ |
581 | 583 | } |
582 | 584 | wfProfileOut( 'main-try-filecache' ); |
583 | 585 | } |
584 | | - |
| 586 | + |
585 | 587 | $this->performRequest(); |
586 | 588 | $this->finalCleanup(); |
587 | | - |
| 589 | + |
588 | 590 | wfProfileOut( __METHOD__ ); |
589 | 591 | } |
590 | 592 | } |