From: Aaron Schulz Date: Fri, 31 Oct 2014 21:16:06 +0000 (-0700) Subject: Made LogEventsList use the log bloom filter, not just the Article class X-Git-Tag: 1.31.0-rc.0~13413 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=e7d5b09d1d77fc295d715a7772a03905d6f305b7;p=lhc%2Fweb%2Fwiklou.git Made LogEventsList use the log bloom filter, not just the Article class Change-Id: I6c523d4ecd60dab080537cabc5aa1c632950e018 --- diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 70f1f1adb9..8421672ebb 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -535,7 +535,23 @@ class LogEventsList extends ContextSource { $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 ) { diff --git a/includes/page/Article.php b/includes/page/Article.php index 54fab29a55..7900b2cc00 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1248,16 +1248,12 @@ class Article implements Page { 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