Index: trunk/phase3/includes/Setup.php |
— | — | @@ -365,7 +365,7 @@ |
366 | 366 | |
367 | 367 | // Now that variant lists may be available... |
368 | 368 | $wgRequest->interpolateTitle(); |
369 | | -$wgUser = $wgCommandLineMode ? new User : User::newFromSession(); |
| 369 | +$wgUser = RequestContext::getMain()->user; # BackCompat |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * @var Language |
— | — | @@ -375,7 +375,7 @@ |
376 | 376 | /** |
377 | 377 | * @var OutputPage |
378 | 378 | */ |
379 | | -$wgOut = new OutputPage; |
| 379 | +$wgOut = RequestContext::getMain()->output; # BackCompat |
380 | 380 | |
381 | 381 | /** |
382 | 382 | * @var Parser |
Index: trunk/phase3/includes/RequestContext.php |
— | — | @@ -60,15 +60,6 @@ |
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | | - * Set the OutputPage object |
65 | | - * |
66 | | - * @param $u OutputPage |
67 | | - */ |
68 | | - public function setOutput( OutputPage $o ) { |
69 | | - $this->mOutput = $o; |
70 | | - } |
71 | | - |
72 | | - /** |
73 | 64 | * Get the OutputPage object |
74 | 65 | * |
75 | 66 | * @return OutputPage object |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -56,10 +56,8 @@ |
57 | 57 | return wfSetVar( $this->context->output, $x ); |
58 | 58 | } |
59 | 59 | |
60 | | - public function __construct( WebRequest &$request, /*OutputPage*/ &$output ){ |
61 | | - $this->context = new RequestContext(); |
62 | | - $this->context->setRequest( $request ); |
63 | | - $this->context->setOutput( $output ); |
| 60 | + public function __construct( RequestContext $context ){ |
| 61 | + $this->context = $context; |
64 | 62 | $this->context->setTitle( $this->parseTitle() ); |
65 | 63 | } |
66 | 64 | |
— | — | @@ -68,9 +66,8 @@ |
69 | 67 | * Performs the request too |
70 | 68 | * |
71 | 69 | * @param $article Article |
72 | | - * @param $user User |
73 | 70 | */ |
74 | | - public function performRequestForTitle( &$article, &$user ) { |
| 71 | + public function performRequestForTitle( &$article ) { |
75 | 72 | wfProfileIn( __METHOD__ ); |
76 | 73 | |
77 | 74 | if ( $this->context->request->getVal( 'printable' ) === 'yes' ) { |
— | — | @@ -81,7 +78,7 @@ |
82 | 79 | &$this->context->title, |
83 | 80 | &$article, |
84 | 81 | &$this->context->output, |
85 | | - &$user, |
| 82 | + &$this->context->user, |
86 | 83 | $this->context->request, |
87 | 84 | $this |
88 | 85 | ) ); |
— | — | @@ -104,7 +101,7 @@ |
105 | 102 | $new_article = $this->initializeArticle(); |
106 | 103 | if ( is_object( $new_article ) ) { |
107 | 104 | $article = $new_article; |
108 | | - $this->performAction( $article, $user ); |
| 105 | + $this->performAction( $article ); |
109 | 106 | } elseif ( is_string( $new_article ) ) { |
110 | 107 | $this->context->output->redirect( $new_article ); |
111 | 108 | } else { |
— | — | @@ -454,14 +451,13 @@ |
455 | 452 | * Perform one of the "standard" actions |
456 | 453 | * |
457 | 454 | * @param $article Article |
458 | | - * @param $user User |
459 | 455 | */ |
460 | | - private function performAction( &$article, &$user ) { |
| 456 | + private function performAction( &$article ) { |
461 | 457 | wfProfileIn( __METHOD__ ); |
462 | 458 | |
463 | 459 | if ( !wfRunHooks( 'MediaWikiPerformAction', array( |
464 | 460 | $this->context->output, $article, $this->context->title, |
465 | | - $user, $this->context->request, $this ) ) ) |
| 461 | + $this->context->user, $this->context->request, $this ) ) ) |
466 | 462 | { |
467 | 463 | wfProfileOut( __METHOD__ ); |
468 | 464 | return; |
— | — | @@ -523,16 +519,16 @@ |
524 | 520 | } |
525 | 521 | /* Continue... */ |
526 | 522 | case 'edit': |
527 | | - if ( wfRunHooks( 'CustomEditor', array( $article, $user ) ) ) { |
| 523 | + if ( wfRunHooks( 'CustomEditor', array( $article, $this->context->user ) ) ) { |
528 | 524 | $internal = $this->context->request->getVal( 'internaledit' ); |
529 | 525 | $external = $this->context->request->getVal( 'externaledit' ); |
530 | 526 | $section = $this->context->request->getVal( 'section' ); |
531 | 527 | $oldid = $this->context->request->getVal( 'oldid' ); |
532 | 528 | if ( !$this->getVal( 'UseExternalEditor' ) || $action == 'submit' || $internal || |
533 | | - $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) { |
| 529 | + $section || $oldid || ( !$this->context->user->getOption( 'externaleditor' ) && !$external ) ) { |
534 | 530 | $editor = new EditPage( $article ); |
535 | 531 | $editor->submit(); |
536 | | - } elseif ( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) { |
| 532 | + } elseif ( $this->getVal( 'UseExternalEditor' ) && ( $external || $this->context->user->getOption( 'externaleditor' ) ) ) { |
537 | 533 | $mode = $this->context->request->getVal( 'mode' ); |
538 | 534 | $extedit = new ExternalEdit( $article, $mode ); |
539 | 535 | $extedit->edit(); |
Index: trunk/phase3/index.php |
— | — | @@ -63,7 +63,8 @@ |
64 | 64 | } |
65 | 65 | |
66 | 66 | # Initialize MediaWiki base class |
67 | | -$mediaWiki = new MediaWiki( $wgRequest, $wgOut ); |
| 67 | +$context = RequestContext::getMain(); |
| 68 | +$mediaWiki = new MediaWiki( $context ); |
68 | 69 | |
69 | 70 | # Set title from request parameters |
70 | 71 | $wgTitle = $mediaWiki->getTitle(); |
— | — | @@ -89,14 +90,14 @@ |
90 | 91 | $cache = new HTMLFileCache( $wgTitle, $action ); |
91 | 92 | if ( $cache->isFileCacheGood( /* Assume up to date */ ) ) { |
92 | 93 | /* Check incoming headers to see if client has this cached */ |
93 | | - if ( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) { |
| 94 | + if ( !$context->output->checkLastModified( $cache->fileCacheTime() ) ) { |
94 | 95 | $cache->loadFromFileCache(); |
95 | 96 | } |
96 | 97 | # Do any stats increment/watchlist stuff |
97 | 98 | $wgArticle = MediaWiki::articleFromTitle( $wgTitle ); |
98 | 99 | $wgArticle->viewUpdates(); |
99 | | - # Tell $wgOut that output is taken care of |
100 | | - $wgOut->disable(); |
| 100 | + # Tell OutputPage that output is taken care of |
| 101 | + $context->output->disable(); |
101 | 102 | wfProfileOut( 'index.php-filecache' ); |
102 | 103 | $mediaWiki->finalCleanup(); |
103 | 104 | wfProfileOut( 'index.php' ); |
— | — | @@ -116,7 +117,7 @@ |
117 | 118 | $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor ); |
118 | 119 | $mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo ); |
119 | 120 | |
120 | | -$mediaWiki->performRequestForTitle( $wgArticle, $wgUser ); |
| 121 | +$mediaWiki->performRequestForTitle( $wgArticle ); |
121 | 122 | $mediaWiki->finalCleanup(); |
122 | 123 | |
123 | 124 | wfProfileOut( 'index.php' ); |