- break;
- case 'submit':
- if ( session_id() == '' ) {
- // Send a cookie so anons get talk message notifications
- wfSetupSession();
- }
- // Continue...
- case 'edit':
- 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' ) || $act == 'submit' || $internal ||
- $section || $oldid || ( !$this->context->user->getOption( 'externaleditor' ) && !$external ) ) {
- $editor = new EditPage( $article );
- $editor->submit();
- } elseif ( $this->getVal( 'UseExternalEditor' ) && ( $external || $this->context->user->getOption( 'externaleditor' ) ) ) {
- $mode = $this->context->request->getVal( 'mode' );
- $extedit = new ExternalEdit( $article, $mode );
- $extedit->edit();
+
+ wfProfileOut( __METHOD__ );
+
+ exit;
+ }
+ }
+ wfProfileOut( __METHOD__ );
+ return true;
+ }
+
+ private function main() {
+ global $wgUseFileCache, $wgTitle, $wgUseAjax;
+
+ wfProfileIn( __METHOD__ );
+
+ $request = $this->context->getRequest();
+
+ // Send Ajax requests to the Ajax dispatcher.
+ 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 ) ) {
+ // Try low-level file cache hit
+ $cache = HTMLFileCache::newFromTitle( $title, $action );
+ if ( $cache->isCacheGood( /* Assume up to date */ ) ) {
+ // Check incoming headers to see if client has this cached
+ $timestamp = $cache->cacheTimestamp();
+ if ( !$this->context->getOutput()->checkLastModified( $timestamp ) ) {
+ $cache->loadFromFileCache( $this->context );