r21758 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21757‎ | r21758 | r21759 >
Date:17:26, 1 May 2007
Author:sanbeg
Status:old
Tags:
Comment:
fix bug 9670: follow redirects in section edit links
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -3212,14 +3212,25 @@
32133213 # replace ==section headers==
32143214 # XXX this needs to go away once we have a better parser.
32153215 if ( !$this->ot['wiki'] && !$this->ot['pre'] && $replaceHeadings ) {
3216 - if( !is_null( $title ) )
3217 - $encodedname = base64_encode($title->getPrefixedDBkey());
 3216+ if( !is_null( $title ) ) {
 3217+
 3218+ #Follow redirects
 3219+ $redirect = new Article($title);
 3220+ $redirect = $redirect->followRedirect();
 3221+ if( ! ($redirect instanceof Title))
 3222+ $redirect = $title;
 3223+
 3224+
 3225+ $encodedname = base64_encode($redirect->getPrefixedDBkey());
 3226+ }
 3227+
32183228 else
32193229 $encodedname = base64_encode("");
32203230 $m = preg_split('/(^={1,6}.*?={1,6}\s*?$)/m', $text, -1,
32213231 PREG_SPLIT_DELIM_CAPTURE);
32223232 $text = '';
32233233 $nsec = $headingOffset;
 3234+
32243235 for( $i = 0; $i < count($m); $i += 2 ) {
32253236 $text .= $m[$i];
32263237 if (!isset($m[$i + 1]) || $m[$i + 1] == "") continue;
Index: trunk/phase3/includes/EditPage.php
@@ -1497,7 +1497,7 @@
14981498 $wgOut->setArticleRelated( false );
14991499
15001500 $wgOut->addWikiText( wfMsg( 'nosuchsectiontext', $this->section ) );
1501 - $wgOut->returnToMain( false );
 1501+ $wgOut->returnToMain( false, $this->mTitle->getPrefixedUrl() );
15021502 }
15031503
15041504 /**
Index: trunk/phase3/RELEASE-NOTES
@@ -373,7 +373,7 @@
374374 * (bug 7629) Fix $wgBrowserBlackList to avoid false positive on MSIE
375375 when certain plugins are present which alter the user agent
376376 * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi
377 -
 377+* (bug 9670) Follow redirects when render edit section links to transcluded templates.
378378 == Maintenance ==
379379
380380 * New script maintenance/language/checkExtensioni18n.php used to check i18n

Follow-up revisions

RevisionCommit summaryAuthorDate
r21777Call new method, for bug 9670sanbeg22:48, 1 May 2007