Change multi-table select to LEFT OUTER JOIN, so actions without consequences show up on the filter page'

This commit is contained in:
Andrew Garrett 2008-06-27 07:55:13 +00:00
parent 22bb5022e9
commit 3bc50d4f95
2 changed files with 11 additions and 3 deletions

View file

@ -252,7 +252,7 @@ class AbuseFilter {
// Fetch from the database.
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'abuse_filter', '*', array( ) );
$res = $dbr->select( 'abuse_filter', '*', array( 'af_enabled' => 1 ) );
$blocking_filters = array();
$log_entries = array();

View file

@ -68,6 +68,11 @@ class SpecialAbuseFilter extends SpecialPage {
$newRow['af_user'] = $wgUser->getId();
$newRow['af_user_text'] = $wgUser->getName();
// ID
if ($filter != 'new') {
$newRow['af_id'] = $filter;
}
// Actions
global $wgAbuseFilterAvailableActions;
$enabledActions = array();
@ -303,7 +308,8 @@ class SpecialAbuseFilter extends SpecialPage {
// We shouldn't have more than 100 filters, so don't bother paging.
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array('abuse_filter','abuse_filter_action'), '*,group_concat(afa_consequence) AS consequences', array( 'afa_filter=af_id' ), __METHOD__, array( 'LIMIT' => 100, 'GROUP BY' => 'af_id' ) );
$res = $dbr->select( array('abuse_filter', 'abuse_filter_action'), 'abuse_filter.*,group_concat(afa_consequence) AS consequences', array( ), __METHOD__, array( 'LIMIT' => 100, 'GROUP BY' => 'af_id' ),
array( 'abuse_filter_action' => array('LEFT OUTER JOIN', 'afa_filter=af_id' ) ) );
$list = '';
$editLabel = $this->canEdit() ? 'abusefilter-list-edit' : 'abusefilter-list-details';
@ -352,7 +358,9 @@ class SpecialAbuseFilter extends SpecialPage {
$editLink = $sk->makeKnownLinkObj( $this->getTitle( $row->af_id ), wfMsg( $editLabel ) );
$values = array( $row->af_id, $wgOut->parse($row->af_public_comments), wfEscapeWikitext($row->consequences), $status, $visibility, $hitCount, $editLink );
$consequences = wfEscapeWikitext($row->consequences);
$values = array( $row->af_id, $wgOut->parse($row->af_public_comments), $consequences, $status, $visibility, $hitCount, $editLink );
foreach( $values as $value ) {
$trow .= Xml::tags( 'td', null, $value );