From: Aaron Schulz Date: Wed, 15 Aug 2007 22:13:03 +0000 (+0000) Subject: *Add ArticleUpdateBeforeRedirect hook, to allow for the page to redirect out differen... X-Git-Tag: 1.31.0-rc.0~51750 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=3343ea495efe60a65dd59917531898f5b9e9eed2;p=lhc%2Fweb%2Fwiklou.git *Add ArticleUpdateBeforeRedirect hook, to allow for the page to redirect out differently after editing (needed for flaggedrevs) *Document ArticleUpdateBeforeRedirect hook --- diff --git a/docs/hooks.txt b/docs/hooks.txt index b33a95131c..a22867ed36 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -332,6 +332,10 @@ $create: Whether or not the restoration caused the page to be created &$pcache: whether to try the parser cache or not &$outputDone: whether the output for this page finished or not +'ArticleUpdateBeforeRedirect': After a page is updated (usually on save), before the user is redirected back to the page +&$article: the article +&$extraq: Extra query parameters which can be added via hooked functions + 'AuthPluginSetup': update or replace authentication plugin object ($wgAuth) Gives a chance for an extension to set it programattically to a variable class. &$auth: the $wgAuth object, probably a stub diff --git a/includes/Article.php b/includes/Article.php index 56feb72eef..10a714b868 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1250,7 +1250,10 @@ class Article { } } - $this->doRedirect( $this->isRedirect( $text ), $sectionanchor ); + $extraq = ''; // Give extensions a chance to modify URL query on update + wfRunHooks( 'ArticleUpdateBeforeRedirect', array($this,&$extraq) ); + + $this->doRedirect( $this->isRedirect( $text ), $sectionanchor, $extraq ); } return $good; } @@ -1486,12 +1489,14 @@ class Article { * @param boolean $noRedir Add redirect=no * @param string $sectionAnchor section to redirect to, including "#" */ - function doRedirect( $noRedir = false, $sectionAnchor = '' ) { + function doRedirect( $noRedir = false, $sectionAnchor = '', $extraq = '' ) { global $wgOut; if ( $noRedir ) { $query = 'redirect=no'; + if( $extraq ) + $query .= "&$query"; } else { - $query = ''; + $query = $extraq; } $wgOut->redirect( $this->mTitle->getFullURL( $query ) . $sectionAnchor ); }