From: Alexandre Emsenhuber Date: Wed, 2 Nov 2011 20:18:43 +0000 (+0000) Subject: Early return if the page exists and redlink parameter was provided instead of going... X-Git-Tag: 1.31.0-rc.0~26751 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=bf2dc3d5acefb4eb4a2bc26f707bd0327e6f46c7;p=lhc%2Fweb%2Fwiklou.git Early return if the page exists and redlink parameter was provided instead of going through all the normal process and then redirect; also moved a part of outside the "else" condition for consistency with the code below --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 1696b26a6a..43a14d92b2 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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;