From: Roan Kattouw Date: Wed, 30 Nov 2011 14:51:07 +0000 (+0000) Subject: )bug 15521) Use new section summary when the action of adding a new section also... X-Git-Tag: 1.31.0-rc.0~26216 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=18648488c412a8bb509e61e7e576b893ce5a8820;p=lhc%2Fweb%2Fwiklou.git )bug 15521) Use new section summary when the action of adding a new section also happens to create the page. Patch by Harry Burt --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 05374062e4..9584b3f5fa 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -867,7 +867,7 @@ class EditPage { case self::AS_SUCCESS_NEW_ARTICLE: $query = $resultDetails['redirect'] ? 'redirect=no' : ''; - $wgOut->redirect( $this->mTitle->getFullURL( $query ) ); + $wgOut->redirect( $this->mTitle->getFullURL( $query ) . $resultDetails['sectionanchor'] ); return false; case self::AS_SUCCESS_UPDATE: @@ -1112,8 +1112,17 @@ class EditPage { } $text = $this->textbox1; + $result['sectionanchor'] == ''; if ( $this->section == 'new' && $this->summary != '' ) { $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text; + + # Jump to the new section + $result['sectionanchor'] = $wgParser->guessLegacySectionNameFromWikiText( $this->summary ); + + # This is a new section, so create a link to the new section + # in the revision summary. + $cleanSummary = $wgParser->stripSectionName( $this->summary ); + $this->summary = wfMsgForContent( 'newsectionsummary', $cleanSummary ); } $status->value = self::AS_SUCCESS_NEW_ARTICLE;