From 525cc3f6061156aab65104f6a59e9273e7ab777e Mon Sep 17 00:00:00 2001 From: Platonides Date: Wed, 27 Jan 2010 14:39:03 +0000 Subject: [PATCH] Revert r61572. These titles are output parameters. A reference is the only way they can work correctly (eg. think on a hook that always does 'return $titleResult = Title::newFromText("Foo");'). --- docs/hooks.txt | 4 ++-- includes/search/SearchEngine.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 0691bc3b14..156feb9bc9 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1289,7 +1289,7 @@ $text : Current text being indexed 'SearchGetNearMatchBefore': Perform exact-title-matches in "go" searches before the normal operations $allSearchTerms : Array of the search terms in all content languages -$titleResult : Outparam; the value to return. A Title object or null. +&$titleResult : Outparam; the value to return. A Title object or null. 'SearchGetNearMatch': An extra chance for exact-title-matches in "go" searches if nothing was found $term : Search term string @@ -1297,7 +1297,7 @@ $term : Search term string 'SearchGetNearMatchComplete': A chance to modify exact-title-matches in "go" searches $term : Search term string -$title : Current Title object that is being returned (null if none found). +&$title : Current Title object that is being returned (null if none found). 'SearchEngineReplacePrefixesComplete': Run after SearchEngine::replacePrefixes(). $searchEngine : The SearchEngine object. Users of this hooks will be interested diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 6ce20fd9e9..f4ca700d5d 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -77,7 +77,7 @@ class SearchEngine { public static function getNearMatch( $searchterm ) { $title = self::getNearMatchInternal( $searchterm ); - wfRunHooks( 'SearchGetNearMatchComplete', array( $searchterm, $title ) ); + wfRunHooks( 'SearchGetNearMatchComplete', array( $searchterm, &$title ) ); return $title; } @@ -93,7 +93,7 @@ class SearchEngine { $allSearchTerms = array_merge($allSearchTerms,$wgContLang->convertLinkToAllVariants($searchterm)); } - if( !wfRunHooks( 'SearchGetNearMatchBefore', array( $allSearchTerms, $titleResult ) ) ) { + if( !wfRunHooks( 'SearchGetNearMatchBefore', array( $allSearchTerms, &$titleResult ) ) ) { return $titleResult; } -- 2.20.1