From 91affe5a52aaa8249267a2715aa1d7130cd18273 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 6 Apr 2015 15:19:56 -0700 Subject: [PATCH] Avoid master queries on SpecialBlockList * Filter out expired rows and rely on the insert() pruning to keep the table size reasonable. Bug: T92357 Change-Id: Icdbd606979d3d9ce9b2d923f574447e3e7dd72f7 --- includes/specials/SpecialBlockList.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 458343028e..0ec144a206 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -113,11 +113,6 @@ class SpecialBlockList extends SpecialPage { } function showList() { - # Purge expired entries on one in every 10 queries - if ( !mt_rand( 0, 10 ) ) { - Block::purgeExpired(); - } - $conds = array(); # Is the user allowed to see hidden blocks? if ( !$this->getUser()->isAllowed( 'hideuser' ) ) { @@ -398,6 +393,10 @@ class BlockListPager extends TablePager { 'join_conds' => array( 'user' => array( 'LEFT JOIN', 'user_id = ipb_by' ) ) ); + # Filter out any expired blocks + $db = $this->getDatabase(); + $info['conds'][] = 'ipb_expiry > ' . $db->addQuotes( $db->timestamp() ); + # Is the user allowed to see hidden blocks? if ( !$this->getUser()->isAllowed( 'hideuser' ) ) { $info['conds']['ipb_deleted'] = 0; -- 2.20.1