Early return if the page exists and redlink parameter was provided instead of going...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 2 Nov 2011 20:18:43 +0000 (20:18 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 2 Nov 2011 20:18:43 +0000 (20:18 +0000)
includes/EditPage.php

index 1696b26..43a14d9 100644 (file)
@@ -385,6 +385,13 @@ class EditPage {
                wfProfileIn( __METHOD__ );
                wfDebug( __METHOD__.": enter\n" );
 
+               // If they used redlink=1 and the page exists, redirect to the main article
+               if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) {
+                       $wgOut->redirect( $this->mTitle->getFullURL() );
+                       wfProfileOut( __METHOD__ );
+                       return;
+               }
+
                $this->importFormData( $wgRequest );
                $this->firsttime = false;
 
@@ -419,28 +426,23 @@ class EditPage {
                        $this->readOnlyPage( $content, true, $permErrors, 'edit' );
                        wfProfileOut( __METHOD__ );
                        return;
-               } else {
-                       if ( $this->save ) {
-                               $this->formtype = 'save';
-                       } elseif ( $this->preview ) {
+               }
+               
+               if ( $this->save ) {
+                       $this->formtype = 'save';
+               } elseif ( $this->preview ) {
+                       $this->formtype = 'preview';
+               } elseif ( $this->diff ) {
+                       $this->formtype = 'diff';
+               } else { # First time through
+                       $this->firsttime = true;
+                       if ( $this->previewOnOpen() ) {
                                $this->formtype = 'preview';
-                       } elseif ( $this->diff ) {
-                               $this->formtype = 'diff';
-                       } else { # First time through
-                               $this->firsttime = true;
-                               if ( $this->previewOnOpen() ) {
-                                       $this->formtype = 'preview';
-                               } else {
-                                       $this->formtype = 'initial';
-                               }
+                       } else {
+                               $this->formtype = 'initial';
                        }
                }
 
-               // If they used redlink=1 and the page exists, redirect to the main article
-               if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) {
-                       $wgOut->redirect( $this->mTitle->getFullURL() );
-               }
-
                wfProfileIn( __METHOD__."-business-end" );
 
                $this->isConflict = false;