http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71850

Revision: 71850
Author:   werdna
Date:     2010-08-28 11:54:49 +0000 (Sat, 28 Aug 2010)

Log Message:
-----------
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
    trunk/extensions/AbuseFilter/SpecialAbuseLog.php

Modified: trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php
===================================================================
--- trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php   2010-08-28 11:16:27 UTC 
(rev 71849)
+++ trunk/extensions/AbuseFilter/ApiQueryAbuseLog.php   2010-08-28 11:54:49 UTC 
(rev 71850)
@@ -84,10 +84,13 @@
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
 
                $this->addWhereRange( 'afl_timestamp', $params['dir'], 
$params['start'], $params['end'] );
+               
+               $db = $this->getDatabase();
+               $notDeletedCond = SpecialAbuseLog::getNotDeletedCondition($db);
 
                $this->addWhereIf( array( 'afl_user_text' => $params['user'] ), 
isset( $params['user'] ) );
                $this->addWhereIf( array( 'afl_filter' => $params['filter'] ), 
isset( $params['filter'] ) );
-               $this->addWhereIf( array( 'afl_deleted' => 0 ), 
!SpecialAbuseLog::canSeeHidden() );
+               $this->addWhereIf( $notDeletedCond, 
!SpecialAbuseLog::canSeeHidden() );
 
                $title = $params['title'];
                if ( !is_null( $title ) ) {

Modified: trunk/extensions/AbuseFilter/SpecialAbuseLog.php
===================================================================
--- trunk/extensions/AbuseFilter/SpecialAbuseLog.php    2010-08-28 11:16:27 UTC 
(rev 71849)
+++ trunk/extensions/AbuseFilter/SpecialAbuseLog.php    2010-08-28 11:54:49 UTC 
(rev 71850)
@@ -459,6 +459,17 @@
 
                return $li ? Xml::tags( 'li', null, $description ) : 
$description;
        }
+       
+       public static function getNotDeletedCond( $db ) {
+               $deletedZeroCond = $db->makeList(
+                               array( 'afl_deleted' => 0 ), LIST_AND );
+               $deletedNullCond = $db->makeList(
+                               array( 'afl_deleted' => null ), LIST_AND );
+               $notDeletedCond = $db->makeList(
+                       array( $deletedZeroCond, $deletedNullCond ), LIST_OR );
+                       
+               return $notDeletedCond;
+       }
 }
 
 class AbuseLogPager extends ReverseChronologicalPager {
@@ -491,7 +502,8 @@
                );
 
                if ( !$this->mForm->canSeeHidden() ) {
-                       $info['conds']['afl_deleted'] = 0;
+                       $db = $this->mDb;
+                       $info['conds'][] = 
SpecialAbuseLog::getNotDeletedCond($db);
                }
 
                return $info;



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to