From: Krinkle Date: Sat, 21 Jan 2012 20:13:57 +0000 (+0000) Subject: [Action] Fix action=ajax X-Git-Tag: 1.31.0-rc.0~25146 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=db97a3a3f99de76d326192dfad15700de4dcb392;p=lhc%2Fweb%2Fwiklou.git [Action] Fix action=ajax * Move Ajax stuff to before regular title/page action handling. Ajax actions circumvent most stuff and return early from the regular execution. * Needed because getAction / Action-classes can't handle action=ajax properly, which isn't until MediaWiki::performAction * Also undo's debug 'true' in the if-statement from r109688 --- diff --git a/includes/Wiki.php b/includes/Wiki.php index eaa3996bc7..bea306101b 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -547,20 +547,28 @@ class MediaWiki { wfProfileIn( __METHOD__ ); - // Get title from request parameters, - // is set on the fly by parseTitle the first time. - $title = $this->getTitle(); - $action = $this->getAction(); - $wgTitle = $title; + $request = $this->context->getRequest(); // Send Ajax requests to the Ajax dispatcher. - if ( $wgUseAjax && true ) { + if ( $wgUseAjax && $request->getVal( 'action', 'view' ) == 'ajax' ) { + + // Set a dummy title, because $wgTitle == null might break things + $title = Title::makeTitle( NS_MAIN, 'AJAX' ); + $this->context->setTitle( $title ); + $wgTitle = $title; + $dispatcher = new AjaxDispatcher(); $dispatcher->performAction(); wfProfileOut( __METHOD__ ); return; } + // Get title from request parameters, + // is set on the fly by parseTitle the first time. + $title = $this->getTitle(); + $action = $this->getAction(); + $wgTitle = $title; + if ( $wgUseFileCache && $title->getNamespace() >= 0 ) { wfProfileIn( 'main-try-filecache' ); if ( HTMLFileCache::useFileCache( $this->context ) ) {