From: Bryan Tong Minh Date: Mon, 13 Dec 2010 20:00:43 +0000 (+0000) Subject: Follow-up r78297: allow the hook to break the execution; added &$term: could be usefu... X-Git-Tag: 1.31.0-rc.0~33335 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=f29e192da9e56354e296b6d4f4726d4b5adab1c4;p=lhc%2Fweb%2Fwiklou.git Follow-up r78297: allow the hook to break the execution; added &$term: could be useful for modifying the edit link --- diff --git a/docs/hooks.txt b/docs/hooks.txt index e528d7a3cf..2fc81d9211 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1609,6 +1609,7 @@ $opts: FormOptions for this request 'SpecialSearchGo': called when user clicked the "Go" &$title: title object generated from the text entered by the user +&$term: the search term entered by the user 'SpecialSearchNogomatch': called when user clicked the "Go" button but the target doesn't exist diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 1d5dfd7d94..b3812e3c29 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -102,7 +102,12 @@ class SpecialSearch extends SpecialPage { } # If there's an exact or very near match, jump right there. $t = SearchEngine::getNearMatch( $term ); - wfRunHooks( 'SpecialSearchGo', array( &$t ) ); + + if ( !wfRunHooks( 'SpecialSearchGo', array( &$t, &$term ) ) ) { + # Hook requested termination + return; + } + if( !is_null( $t ) ) { $wgOut->redirect( $t->getFullURL() ); return;