- $wgOut->setSyndicated( $this->isSyndicated() );
-
- # Really really do the query now
- $result = $this->reallyDoQuery( $offset, $limit );
-
- # Tell about cachiness
- if ( $result['cached'] !== false ) {
- if ( $result['cached'] === true ) {
- $wgOut->addWikiMsg( 'perfcached' );
- } else {
- $updated = $wgLang->timeAndDate( $result['cached'], true, true );
- $wgOut->addMeta( 'Data-Cache-Time', $result['cached'] );
- $wgOut->addInlineScript( "var dataCacheTime = '{$result['cached']}';" );
- $wgOut->addWikiMsg( 'perfcachedts', $updated );
- }
- }
- if ( $result['disabled'] ) {
- # If updates on this page have been disabled, let the user know
- # that the data set won't be refreshed for now
-
- $wgOut->addWikiMsg( 'querypage-no-updates' );
- }
-
- $wgOut->addHTML( XML::openElement( 'div', array('class' => 'mw-spcontent') ) );
-
- # Top header and navigation
- if( $shownavigation ) {
- $wgOut->addHTML( $this->getPageHeader() );
- if( $result['count'] > 0 ) {
- $wgOut->addHTML( '<p>' . wfShowingResults( $offset, $result['count'] ) . '</p>' );
- # Disable the "next" link when we reach the end
- $paging = wfViewPrevNext( $offset, $limit, $wgContLang->specialPage( $this->getName() ),
- wfArrayToCGI( $this->linkParameters() ), ( $result['count'] < $limit ) );
- $wgOut->addHTML( '<p>' . $paging . '</p>' );
- } else {
- # No results to show, so don't bother with "showing X of Y" etc.
- # -- just let the user know and give up now
- $wgOut->addHTML( '<p>' . wfMsgHtml( 'specialpage-empty' ) . '</p>' );
- $wgOut->addHTML( XML::closeElement( 'div' ) );
- return;
- }
- }
-
- # The actual results; specialist subclasses will want to handle this
- # with more than a straight list, so we hand them the info, plus
- # an OutputPage, and let them get on with it
- $this->outputResults( $wgOut,
- $wgUser->getSkin(),
- $result['dbr'], # Should use a ResultWrapper for this
- $result['result'],
- $result['count'],
- $offset );
-
- # Repeat the paging links at the bottom
- if( $shownavigation ) {
- $wgOut->addHTML( '<p>' . $paging . '</p>' );
- }
-
- $wgOut->addHTML( XML::closeElement( 'div' ) );
-
- return $result['count'];
- }
-
- /**
- * Really really do the query. Returns an array with:
- * 'disabled' => true if the data will not be further refreshed,
- * 'cached' => false if uncached, the timestamp of the last cache if known, else simply true,
- * 'result' => the real result object,
- * 'count' => number of results,
- * 'dbr' => the database used for fetching the data
- */
- protected function reallyDoQuery( $offset, $limit ) {
- $result = array( 'disabled' => false );
-