r24841 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24840‎ | r24841 | r24842 >
Date:22:13, 15 August 2007
Author:aaron
Status:old
Tags:
Comment:
*Add ArticleUpdateBeforeRedirect hook, to allow for the page to redirect out differently after editing (needed for flaggedrevs)
*Document ArticleUpdateBeforeRedirect hook
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -332,6 +332,10 @@
333333 &$pcache: whether to try the parser cache or not
334334 &$outputDone: whether the output for this page finished or not
335335
 336+'ArticleUpdateBeforeRedirect': After a page is updated (usually on save), before the user is redirected back to the page
 337+&$article: the article
 338+&$extraq: Extra query parameters which can be added via hooked functions
 339+
336340 'AuthPluginSetup': update or replace authentication plugin object ($wgAuth)
337341 Gives a chance for an extension to set it programattically to a variable class.
338342 &$auth: the $wgAuth object, probably a stub
Index: trunk/phase3/includes/Article.php
@@ -1250,7 +1250,10 @@
12511251 }
12521252 }
12531253
1254 - $this->doRedirect( $this->isRedirect( $text ), $sectionanchor );
 1254+ $extraq = ''; // Give extensions a chance to modify URL query on update
 1255+ wfRunHooks( 'ArticleUpdateBeforeRedirect', array($this,&$extraq) );
 1256+
 1257+ $this->doRedirect( $this->isRedirect( $text ), $sectionanchor, $extraq );
12551258 }
12561259 return $good;
12571260 }
@@ -1486,12 +1489,14 @@
14871490 * @param boolean $noRedir Add redirect=no
14881491 * @param string $sectionAnchor section to redirect to, including "#"
14891492 */
1490 - function doRedirect( $noRedir = false, $sectionAnchor = '' ) {
 1493+ function doRedirect( $noRedir = false, $sectionAnchor = '', $extraq = '' ) {
14911494 global $wgOut;
14921495 if ( $noRedir ) {
14931496 $query = 'redirect=no';
 1497+ if( $extraq )
 1498+ $query .= "&$query";
14941499 } else {
1495 - $query = '';
 1500+ $query = $extraq;
14961501 }
14971502 $wgOut->redirect( $this->mTitle->getFullURL( $query ) . $sectionAnchor );
14981503 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r24866Merged revisions 24755-24865 via svnmerge from...david23:08, 16 August 2007

Status & tagging log