r61575 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61574‎ | r61575 | r61576 >
Date:14:39, 27 January 2010
Author:platonides
Status:ok
Tags:
Comment:
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");').
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/search/SearchEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1289,7 +1289,7 @@
12901290
12911291 'SearchGetNearMatchBefore': Perform exact-title-matches in "go" searches before the normal operations
12921292 $allSearchTerms : Array of the search terms in all content languages
1293 -$titleResult : Outparam; the value to return. A Title object or null.
 1293+&$titleResult : Outparam; the value to return. A Title object or null.
12941294
12951295 'SearchGetNearMatch': An extra chance for exact-title-matches in "go" searches if nothing was found
12961296 $term : Search term string
@@ -1297,7 +1297,7 @@
12981298
12991299 'SearchGetNearMatchComplete': A chance to modify exact-title-matches in "go" searches
13001300 $term : Search term string
1301 -$title : Current Title object that is being returned (null if none found).
 1301+&$title : Current Title object that is being returned (null if none found).
13021302
13031303 'SearchEngineReplacePrefixesComplete': Run after SearchEngine::replacePrefixes().
13041304 $searchEngine : The SearchEngine object. Users of this hooks will be interested
Index: trunk/phase3/includes/search/SearchEngine.php
@@ -77,7 +77,7 @@
7878 public static function getNearMatch( $searchterm ) {
7979 $title = self::getNearMatchInternal( $searchterm );
8080
81 - wfRunHooks( 'SearchGetNearMatchComplete', array( $searchterm, $title ) );
 81+ wfRunHooks( 'SearchGetNearMatchComplete', array( $searchterm, &$title ) );
8282 return $title;
8383 }
8484
@@ -93,7 +93,7 @@
9494 $allSearchTerms = array_merge($allSearchTerms,$wgContLang->convertLinkToAllVariants($searchterm));
9595 }
9696
97 - if( !wfRunHooks( 'SearchGetNearMatchBefore', array( $allSearchTerms, $titleResult ) ) ) {
 97+ if( !wfRunHooks( 'SearchGetNearMatchBefore', array( $allSearchTerms, &$titleResult ) ) ) {
9898 return $titleResult;
9999 }
100100

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61572Apply r61570 (Follow-up r61150: Do not pass objects as references in new hooks)....platonides11:52, 27 January 2010

Status & tagging log