From: Aaron Schulz Date: Mon, 6 Apr 2015 22:19:56 +0000 (-0700) Subject: Avoid master queries on SpecialBlockList X-Git-Tag: 1.31.0-rc.0~11818^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=91affe5a52aaa8249267a2715aa1d7130cd18273;p=lhc%2Fweb%2Fwiklou.git 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 --- 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;