getName(); $fname = get_class($this) . "::doQuery"; $wgOut->setSyndicated( true ); if ( $this->isExpensive( ) ) { $vsp = $wgLang->getValidSpecialPages(); $logpage = new LogPage( "!" . $vsp[$sname] ); $logpage->mUpdateRecentChanges = false; if ( $wgMiserMode ) { $logpage->showAsDisabledPage(); return; } } $sql = $this->getSQL( $offset, $limit ); $res = wfQuery( $sql, DB_READ, $fname ); $num = wfNumRows($res); $sk = $wgUser->getSkin( ); $top = wfShowingResults( $offset, $num); $wgOut->addHTML( "
{$top}\n" );
# often disable 'next' link when we reach the end
if($num < $limit) { $atend = true; } else { $atend = false; }
$sl = wfViewPrevNext( $offset, $limit , $wgLang->specialPage( $sname ), "" ,$atend );
$wgOut->addHTML( "
{$sl}
{$sl}
\n" ); # Saving cache if ( $this->isExpensive() && $offset == 0 && $limit >= 50 ) { $logpage->replaceContent( $s ); } } # Similar to above, but packaging in a syndicated feed instead of a web page function doFeed( $class = "" ) { global $wgFeedClasses; global $wgOut, $wgLanguageCode, $wgLang; if( isset($wgFeedClasses[$class]) ) { $feed = new $wgFeedClasses[$class]( $this->feedTitle(), $this->feedDesc(), $this->feedUrl() ); $feed->outHeader(); $sql = $this->getSQL( 0, 50 ); $res = wfQuery( $sql, DB_READ, "QueryPage::doFeed" ); while( $obj = wfFetchObject( $res ) ) { $item = $this->feedResult( $obj ); if( $item ) $feed->outItem( $item ); } wfFreeResult( $res ); $feed->outFooter(); return true; } else { return false; } } # Override for custom handling. If the titles/links are ok, just do feedItemDesc() function feedResult( $row ) { if( isset( $row->cur_title ) ) { $title = Title::MakeTitle( $row->cur_namespace, $row->cur_title ); } elseif( isset( $row->old_title ) ) { $title = Title::MakeTitle( $row->old_namespace, $row->old_title ); } elseif( isset( $row->rc_title ) ) { $title = Title::MakeTitle( $row->rc_namespace, $row->rc_title ); } else { return NULL; } if( $title ) { $date = ""; if( isset( $row->cur_timestamp ) ) { $date = $row->cur_timestamp; } elseif( isset( $row->old_timestamp ) ) { $date = $row->old_timestamp; } elseif( isset( $row->rc_cur_timestamp ) ) { $date = $row->rc_cur_timestamp; } $comments = ""; if( isset( $row->cur_comment ) ) { $comments = $row->cur_comment; } elseif( isset( $row->old_comment ) ) { $comments = $row->old_comment; } elseif( isset( $row->rc_cur_comment ) ) { $comments = $row->rc_cur_comment; } return new FeedItem( $title->getText(), $this->feedItemDesc( $row ), $title->getFullURL(), $date, $this->feedItemAuthor( $row ), $comments); } else { return NULL; } } function feedItemDesc( $row ) { $text = ""; if( isset( $row->cur_comment ) ) { $text = $row->cur_comment; } elseif( isset( $row->old_comment ) ) { $text = $row->old_comment; } elseif( isset( $row->rc_comment ) ) { $text = $row->rc_comment; } $text = htmlspecialchars( $text ); if( isset( $row->cur_text ) ) { $text = "" . htmlspecialchars( wfMsg( "summary" ) ) . ": " . $text . "
\n