X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FQueryPage.php;h=4ac5aa9d54d69ba2512e843b774cb4e26762e93d;hb=a4de8c5cff8b46e6381803d57d8a28c436f3e6f7;hp=90954ceb9af430f01312f03e2c33ace7c2ac2b64;hpb=8928e2ca8b1c0dfc98975d1457b2cb34ba0d78a3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 90954ceb9a..4ac5aa9d54 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -79,6 +79,7 @@ class QueryPage { * Formats the results of the query for display. The skin is the current * skin; you can use it for making links. The result is a single row of * result data. You should be able to grab SQL results off of it. + * If the function return "false", the line output will be skipped. */ function formatResult( $skin, $result ) { return ''; @@ -90,6 +91,16 @@ class QueryPage { function getPageHeader( ) { return ''; } + + /** + * Some special pages (for example SpecialListusers) might not return the + * current object formatted, but return the previous one instead. + * Setting this to return true, will call one more time wfFormatResult to + * be sure that the very last result is formatted and shown. + */ + function tryLastResult( ) { + return false; + } /** * This is the actual workhorse. It does everything needed to make a @@ -182,13 +193,28 @@ class QueryPage { if ( $num > 0 ) { $s = "
    "; + # Only read at most $num rows, because $res may contain the whole 1000 for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) { $format = $this->formatResult( $sk, $obj ); - $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol && - $obj->patrolled == 0 ) ? ' class="not-patrolled"' : ''; - $s .= "{$format}\n"; + if ( $format ) { + $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol && + $obj->patrolled == 0 ) ? ' class="not-patrolled"' : ''; + $s .= "{$format}\n"; + } + } + + if($this->tryLastResult()) { + // flush the very last result + $obj = null; + $format = $this->formatResult( $sk, $obj ); + if( $format ) { + $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol && + $obj->patrolled == 0 ) ? ' class="not-patrolled"' : ''; + $s .= "{$format}\n"; + } } + $dbr->freeResult( $res ); $s .= '
'; $wgOut->addHTML( $s );