From 2816da86310a6142d78122fa35a971468a2c6592 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 8 Sep 2012 16:15:27 +0200 Subject: [PATCH] Some changes to Special:ListUsers and Special:ActiveUsers * Change raw database quoting * Use new syntax for aliased columns * Change AND condition into array syntax * Spacing * Change raw html to Html::element Change-Id: Ifebe807ab1c2d5a3e8b6bb22087b6d0040c5794f --- includes/specials/SpecialActiveusers.php | 10 +++++++--- includes/specials/SpecialListusers.php | 24 ++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index aefa6cca4e..c5aa23893d 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -94,8 +94,8 @@ class ActiveUsersPager extends UsersPager { $dbr = wfGetDB( DB_SLAVE ); $conds = array( 'rc_user > 0' ); // Users - no anons $conds[] = 'ipb_deleted IS NULL'; // don't show hidden names - $conds[] = "rc_log_type IS NULL OR rc_log_type != 'newusers'"; - $conds[] = "rc_timestamp >= '{$dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 )}'"; + $conds[] = 'rc_log_type IS NULL OR rc_log_type != ' . $dbr->addQuotes( 'newusers' ); + $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 ) ); if( $this->requestedUser != '' ) { $conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser ); @@ -115,7 +115,11 @@ class ActiveUsersPager extends UsersPager { ), 'join_conds' => array( 'user' => array( 'INNER JOIN', 'rc_user_text=user_name' ), - 'ipblocks' => array( 'LEFT JOIN', 'user_id=ipb_user AND ipb_auto=0 AND ipb_deleted=1' ), + 'ipblocks' => array( 'LEFT JOIN', array( + 'user_id=ipb_user', + 'ipb_auto' => 0, + 'ipb_deleted' => 1 + )), ), 'conds' => $conds ); diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index 923a18dc9c..1089fbbe28 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -88,7 +88,7 @@ class UsersPager extends AlphabeticPager { $dbr = wfGetDB( DB_SLAVE ); $conds = array(); // Don't show hidden names - if( !$this->getUser()->isAllowed('hideuser') ) { + if( !$this->getUser()->isAllowed( 'hideuser' ) ) { $conds[] = 'ipb_deleted IS NULL'; } @@ -116,18 +116,22 @@ class UsersPager extends AlphabeticPager { $query = array( 'tables' => array( 'user', 'user_groups', 'ipblocks'), 'fields' => array( - $this->creationSort ? 'MAX(user_name) AS user_name' : 'user_name', - $this->creationSort ? 'user_id' : 'MAX(user_id) AS user_id', - 'MAX(user_editcount) AS edits', - 'COUNT(ug_group) AS numgroups', - 'MAX(ug_group) AS singlegroup', // the usergroup if there is only one - 'MIN(user_registration) AS creation', - 'MAX(ipb_deleted) AS ipb_deleted' // block/hide status + 'user_name' => $this->creationSort ? 'MAX(user_name)' : 'user_name', + 'user_id' => $this->creationSort ? 'user_id' : 'MAX(user_id)', + 'edits' => 'MAX(user_editcount)', + 'numgroups' => 'COUNT(ug_group)', + 'singlegroup' => 'MAX(ug_group)', // the usergroup if there is only one + 'creation' => 'MIN(user_registration)', + 'ipb_deleted' => 'MAX(ipb_deleted)' // block/hide status ), 'options' => $options, 'join_conds' => array( 'user_groups' => array( 'LEFT JOIN', 'user_id=ug_user' ), - 'ipblocks' => array( 'LEFT JOIN', 'user_id=ipb_user AND ipb_deleted=1 AND ipb_auto=0' ), + 'ipblocks' => array( 'LEFT JOIN', array( + 'user_id=ipb_user', + 'ipb_deleted' => 1, + 'ipb_auto' => 0 + )), ), 'conds' => $conds ); @@ -183,7 +187,7 @@ class UsersPager extends AlphabeticPager { } wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); - return "
  • {$item}{$edits}{$created}
  • "; + return Html::rawElement( 'li', array(), "{$item}{$edits}{$created}" ); } function doBatchLookups() { -- 2.20.1