X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSqlSearchResultSet.php;h=022dc0a64371c0e9b3e70f7af6fd320604c0ddcb;hb=a4777729dd2dd66c871395bdb04f5f6dce75dd94;hp=c3985d1852f167438d60b4bcd8c5442e690ab0bb;hpb=ce079cf6ad79ca8d3360817f809b219d166f9153;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SqlSearchResultSet.php b/includes/search/SqlSearchResultSet.php index c3985d1852..022dc0a643 100644 --- a/includes/search/SqlSearchResultSet.php +++ b/includes/search/SqlSearchResultSet.php @@ -1,11 +1,17 @@ resultSet->numRows(); } - function next() { + public function extractResults() { if ( $this->resultSet === false ) { - return false; - } - - $row = $this->resultSet->fetchObject(); - if ( $row === false ) { - return false; + return []; } - return SearchResult::newFromTitle( - Title::makeTitle( $row->page_namespace, $row->page_title ), $this - ); - } - - function rewind() { - if ( $this->resultSet ) { + if ( $this->results === null ) { + $this->results = []; $this->resultSet->rewind(); + while ( ( $row = $this->resultSet->fetchObject() ) !== false ) { + $this->results[] = SearchResult::newFromTitle( + Title::makeTitle( $row->page_namespace, $row->page_title ), $this + ); + } } + return $this->results; } function free() {