r71850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71849‎ | r71850 | r71851 >
Date:11:54, 28 August 2010
Author:werdna
Status:deferred
Tags:
Comment:
AbuseFilter log deletion: cause afl_deleted=NULL to be treated like afl_deleted=0 to negate the need for a schema change on the WMF cluster
Modified paths:
  • /trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php (modified) (history)
  • /trunk/extensions/AbuseFilter/SpecialAbuseLog.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/SpecialAbuseLog.php
@@ -459,6 +459,17 @@
460460
461461 return $li ? Xml::tags( 'li', null, $description ) : $description;
462462 }
 463+
 464+ public static function getNotDeletedCond( $db ) {
 465+ $deletedZeroCond = $db->makeList(
 466+ array( 'afl_deleted' => 0 ), LIST_AND );
 467+ $deletedNullCond = $db->makeList(
 468+ array( 'afl_deleted' => null ), LIST_AND );
 469+ $notDeletedCond = $db->makeList(
 470+ array( $deletedZeroCond, $deletedNullCond ), LIST_OR );
 471+
 472+ return $notDeletedCond;
 473+ }
463474 }
464475
465476 class AbuseLogPager extends ReverseChronologicalPager {
@@ -491,7 +502,8 @@
492503 );
493504
494505 if ( !$this->mForm->canSeeHidden() ) {
495 - $info['conds']['afl_deleted'] = 0;
 506+ $db = $this->mDb;
 507+ $info['conds'][] = SpecialAbuseLog::getNotDeletedCond($db);
496508 }
497509
498510 return $info;
Index: trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php
@@ -84,10 +84,13 @@
8585 $this->addOption( 'LIMIT', $params['limit'] + 1 );
8686
8787 $this->addWhereRange( 'afl_timestamp', $params['dir'], $params['start'], $params['end'] );
 88+
 89+ $db = $this->getDatabase();
 90+ $notDeletedCond = SpecialAbuseLog::getNotDeletedCondition($db);
8891
8992 $this->addWhereIf( array( 'afl_user_text' => $params['user'] ), isset( $params['user'] ) );
9093 $this->addWhereIf( array( 'afl_filter' => $params['filter'] ), isset( $params['filter'] ) );
91 - $this->addWhereIf( array( 'afl_deleted' => 0 ), !SpecialAbuseLog::canSeeHidden() );
 94+ $this->addWhereIf( $notDeletedCond, !SpecialAbuseLog::canSeeHidden() );
9295
9396 $title = $params['title'];
9497 if ( !is_null( $title ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r71851Re-merge r71332, adding r71850. Going to test on testwiki then roll outwerdna12:01, 28 August 2010

Status & tagging log