r96435 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96434‎ | r96435 | r96436 >
Date:14:07, 7 September 2011
Author:svemir
Status:deferred
Tags:
Comment:
make our own userHighlightPrefs, because someone hard-coded the values in SearchEngine::userHighlightPrefs
Modified paths:
  • /trunk/extensions/SphinxSearch/SphinxMWSearch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SphinxSearch/SphinxMWSearch.php
@@ -155,6 +155,18 @@
156156 return $cl;
157157 }
158158
 159+ /**
 160+ * Find snippet highlight settings for a given user
 161+ *
 162+ * @param $user User
 163+ * @return Array contextlines, contextchars
 164+ */
 165+ public static function userHighlightPrefs( &$user ) {
 166+ $contextlines = $user->getOption( 'contextlines', 2 );
 167+ $contextchars = $user->getOption( 'contextchars', 75 );
 168+ return array( $contextlines, $contextchars );
 169+ }
 170+
159171 }
160172
161173 class SphinxMWSearchResultSet extends SearchResultSet {
@@ -410,8 +422,7 @@
411423
412424 $this->initText();
413425
414 - list( $contextlines, $contextchars ) = SearchEngine::userHighlightPrefs( $wgUser );
415 -
 426+ list( $contextlines, $contextchars ) = SphinxMWSearch::userHighlightPrefs( $wgUser );
416427 $excerpts_opt = array(
417428 "before_match" => "<span class='searchmatch'>",
418429 "after_match" => "</span>",

Status & tagging log