r1343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r1342‎ | r1343 | r1344 >
Date:06:15, 20 May 2003
Author:smurf-wiki
Status:old
Tags:
Comment:
New function ShowingResultsNum for use in SearchEngine.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/SearchEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -448,6 +448,14 @@
449449 return $top;
450450 }
451451
 452+function wfShowingResultsNum( $offset, $limit, $num )
 453+{
 454+ $top = str_replace( "$1", $limit, wfMsg( "showingresultsnum" ) );
 455+ $top = str_replace( "$2", $offset+1, $top );
 456+ $top = str_replace( "$3", $num, $top );
 457+ return $top;
 458+}
 459+
452460 function wfViewPrevNext( $offset, $limit, $link, $query = "" )
453461 {
454462 global $wgUser;
Index: trunk/phase3/includes/SearchEngine.php
@@ -152,6 +152,7 @@
153153 "AND {$searchnamespaces} {$redircond}" .
154154 "LIMIT {$offset}, {$limit}";
155155 $res1 = wfQuery( $sql, $fname );
 156+ $num = wfNumRows($res1);
156157
157158 if ( $wgDisableTextSearch ) {
158159 $res2 = 0;
@@ -162,9 +163,14 @@
163164 "AND {$searchnamespaces} {$redircond} " .
164165 "LIMIT {$offset}, {$limit}";
165166 $res2 = wfQuery( $sql, $fname );
 167+ $num = $num + wfNumRows($res2);
166168 }
167169
168 - $top = wfShowingResults( $offset, $limit );
 170+ if ( $num == $limit ) {
 171+ $top = wfShowingResults( $offset, $limit);
 172+ } else {
 173+ $top = wfShowingResultsNum( $offset, $limit, $num );
 174+ }
169175 $wgOut->addHTML( "<p>{$top}\n" );
170176
171177 # For powersearch

Status & tagging log