$pager->mLimit = $lim;
}
- $logBody = $pager->getBody();
+ $logBody = null;
+ // Check if we can avoid the DB query all together
+ if ( $page !== '' && !$param['useMaster'] ) {
+ $title = ( $page instanceof Title ) ? $page : Title::newFromText( $page );
+ if ( $title ) {
+ $member = $title->getNamespace() . ':' . $title->getDBkey();
+ if ( !BloomCache::get( 'main' )->check( wfWikiId(), 'TitleHasLogs', $member ) ) {
+ $logBody = '';
+ }
+ } else {
+ $logBody = '';
+ }
+ }
+
+ // Fetch the log rows and build the HTML if needed
+ $logBody = ( $logBody === null ) ? $pager->getBody() : $logBody;
+
$s = '';
if ( $logBody ) {
wfRunHooks( 'Article::MissingArticleConditions', array( &$conds, $logTypes ) );
# Show delete and move logs
- $member = $title->getNamespace() . ':' . $title->getDBkey();
- // @todo: move optimization to showLogExtract()?
- if ( BloomCache::get( 'main' )->check( wfWikiId(), 'TitleHasLogs', $member ) ) {
- LogEventsList::showLogExtract( $outputPage, $logTypes, $title, '',
- array( 'lim' => 10,
- 'conds' => $conds,
- 'showIfEmpty' => false,
- 'msgKey' => array( 'moveddeleted-notice' ) )
- );
- }
+ LogEventsList::showLogExtract( $outputPage, $logTypes, $title, '',
+ array( 'lim' => 10,
+ 'conds' => $conds,
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'moveddeleted-notice' ) )
+ );
if ( !$this->mPage->hasViewableContent() && $wgSend404Code && !$validUserPage ) {
// If there's no backing content, send a 404 Not Found