return wfSetVar( $this->context->output, $x );
}
- public function __construct( WebRequest &$request, /*OutputPage*/ &$output ){
- $this->context = new RequestContext();
- $this->context->setRequest( $request );
- $this->context->setOutput( $output );
+ public function __construct( RequestContext $context ){
+ $this->context = $context;
$this->context->setTitle( $this->parseTitle() );
}
* Performs the request too
*
* @param $article Article
- * @param $user User
*/
- public function performRequestForTitle( &$article, &$user ) {
+ public function performRequestForTitle( &$article ) {
wfProfileIn( __METHOD__ );
if ( $this->context->request->getVal( 'printable' ) === 'yes' ) {
&$this->context->title,
&$article,
&$this->context->output,
- &$user,
+ &$this->context->user,
$this->context->request,
$this
) );
$new_article = $this->initializeArticle();
if ( is_object( $new_article ) ) {
$article = $new_article;
- $this->performAction( $article, $user );
+ $this->performAction( $article );
} elseif ( is_string( $new_article ) ) {
$this->context->output->redirect( $new_article );
} else {
* Perform one of the "standard" actions
*
* @param $article Article
- * @param $user User
*/
- private function performAction( &$article, &$user ) {
+ private function performAction( &$article ) {
wfProfileIn( __METHOD__ );
if ( !wfRunHooks( 'MediaWikiPerformAction', array(
$this->context->output, $article, $this->context->title,
- $user, $this->context->request, $this ) ) )
+ $this->context->user, $this->context->request, $this ) ) )
{
wfProfileOut( __METHOD__ );
return;
}
/* Continue... */
case 'edit':
- if ( wfRunHooks( 'CustomEditor', array( $article, $user ) ) ) {
+ if ( wfRunHooks( 'CustomEditor', array( $article, $this->context->user ) ) ) {
$internal = $this->context->request->getVal( 'internaledit' );
$external = $this->context->request->getVal( 'externaledit' );
$section = $this->context->request->getVal( 'section' );
$oldid = $this->context->request->getVal( 'oldid' );
if ( !$this->getVal( 'UseExternalEditor' ) || $action == 'submit' || $internal ||
- $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
+ $section || $oldid || ( !$this->context->user->getOption( 'externaleditor' ) && !$external ) ) {
$editor = new EditPage( $article );
$editor->submit();
- } elseif ( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
+ } elseif ( $this->getVal( 'UseExternalEditor' ) && ( $external || $this->context->user->getOption( 'externaleditor' ) ) ) {
$mode = $this->context->request->getVal( 'mode' );
$extedit = new ExternalEdit( $article, $mode );
$extedit->edit();
}
# Initialize MediaWiki base class
-$mediaWiki = new MediaWiki( $wgRequest, $wgOut );
+$context = RequestContext::getMain();
+$mediaWiki = new MediaWiki( $context );
# Set title from request parameters
$wgTitle = $mediaWiki->getTitle();
$cache = new HTMLFileCache( $wgTitle, $action );
if ( $cache->isFileCacheGood( /* Assume up to date */ ) ) {
/* Check incoming headers to see if client has this cached */
- if ( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) {
+ if ( !$context->output->checkLastModified( $cache->fileCacheTime() ) ) {
$cache->loadFromFileCache();
}
# Do any stats increment/watchlist stuff
$wgArticle = MediaWiki::articleFromTitle( $wgTitle );
$wgArticle->viewUpdates();
- # Tell $wgOut that output is taken care of
- $wgOut->disable();
+ # Tell OutputPage that output is taken care of
+ $context->output->disable();
wfProfileOut( 'index.php-filecache' );
$mediaWiki->finalCleanup();
wfProfileOut( 'index.php' );
$mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
$mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo );
-$mediaWiki->performRequestForTitle( $wgArticle, $wgUser );
+$mediaWiki->performRequestForTitle( $wgArticle );
$mediaWiki->finalCleanup();
wfProfileOut( 'index.php' );