Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73532


Change subject: Do not record IP of registered users
......................................................................

Do not record IP of registered users

Change-Id: Ic2aa82db2a1b42fd8379ae5e810e38c1575f0225
---
M AbuseFilter.class.php
M AbuseFilter.hooks.php
M abusefilter.tables.pg.sql
M abusefilter.tables.sql
M abusefilter.tables.sqlite.sql
M api/ApiQueryAbuseLog.php
M special/SpecialAbuseLog.php
7 files changed, 2 insertions(+), 48 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/32/73532/1

diff --git a/AbuseFilter.class.php b/AbuseFilter.class.php
index 3eaf0bd..d7291ae 100644
--- a/AbuseFilter.class.php
+++ b/AbuseFilter.class.php
@@ -868,8 +868,7 @@
                        'afl_user_text' => $wgUser->getName(),
                        'afl_timestamp' => $dbr->timestamp( wfTimestampNow() ),
                        'afl_namespace' => $title->getNamespace(),
-                       'afl_title' => $title->getDBkey(),
-                       'afl_ip' => $wgRequest->getIP()
+                       'afl_title' => $title->getDBkey()
                );
 
                // Hack to avoid revealing IPs of people creating accounts
diff --git a/AbuseFilter.hooks.php b/AbuseFilter.hooks.php
index 42debad..449d1f5 100644
--- a/AbuseFilter.hooks.php
+++ b/AbuseFilter.hooks.php
@@ -488,6 +488,7 @@
                        } else {
                                $updater->addExtensionUpdate( array( 
'addIndex', 'abuse_filter_log', 'afl_wiki_timestamp', 
"$dir/db_patches/patch-global_logging_wiki-index.sqlite.sql", true ) );
                        }
+                       $updater->dropExtensionField( 'abuse_filter_log', 
'afl_ip', "$dir/db_patches/patch-afl_ip_drop.sql" );
 
                } elseif ( $updater->getDB()->getType() == 'postgres' ) {
                        $updater->addExtensionUpdate( array( 'addTable', 
'abuse_filter', "$dir/abusefilter.tables.pg.sql", true ) );
@@ -498,7 +499,6 @@
                        $updater->addExtensionUpdate( array( 'addPgField', 
'abuse_filter_log', 'afl_wiki', 'TEXT' ) );
                        $updater->addExtensionUpdate( array( 'addPgField', 
'abuse_filter_log', 'afl_deleted', 'SMALLINT' ) );
                        $updater->addExtensionUpdate( array( 'changeField', 
'abuse_filter_log', 'afl_filter', 'TEXT', '' ) );
-                       $updater->addExtensionUpdate( array( 'addPgExtIndex', 
'abuse_filter_log', 'abuse_filter_log_ip', "(afl_ip)" ) );
                        $updater->addExtensionUpdate( array( 'addPgExtIndex', 
'abuse_filter_log', 'abuse_filter_log_wiki', "(afl_wiki)" ) );
                }
 
diff --git a/abusefilter.tables.pg.sql b/abusefilter.tables.pg.sql
index 586986f..269ea12 100644
--- a/abusefilter.tables.pg.sql
+++ b/abusefilter.tables.pg.sql
@@ -41,7 +41,6 @@
     afl_filter     TEXT         NOT NULL,
     afl_user       INTEGER      NOT NULL,
     afl_user_text  TEXT         NOT NULL,
-    afl_ip         TEXT         NOT NULL,
     afl_action     TEXT         NOT NULL,
     afl_actions    TEXT         NOT NULL,
     afl_var_dump   TEXT         NOT NULL,
@@ -52,7 +51,6 @@
        afl_deleted    SMALLINT         NULL
 );
 CREATE INDEX abuse_filter_log_filter    ON abuse_filter_log(afl_filter);
-CREATE INDEX abuse_filter_log_ip        ON abuse_filter_log(afl_ip);
 CREATE INDEX abuse_filter_log_timestamp ON abuse_filter_log(afl_timestamp);
 CREATE INDEX abuse_filter_log_title     ON abuse_filter_log(afl_namespace, 
afl_title);
 CREATE INDEX abuse_filter_log_user      ON abuse_filter_log(afl_user);
diff --git a/abusefilter.tables.sql b/abusefilter.tables.sql
index 20e9877..1c758a5 100644
--- a/abusefilter.tables.sql
+++ b/abusefilter.tables.sql
@@ -36,7 +36,6 @@
        afl_filter varchar(64) binary NOT NULL,
        afl_user BIGINT unsigned NOT NULL,
        afl_user_text varchar(255) binary NOT NULL,
-       afl_ip varchar(255) not null,
        afl_action varbinary(255) not null,
        afl_actions varbinary(255) not null,
        afl_var_dump BLOB NOT NULL,
@@ -54,7 +53,6 @@
        KEY user_timestamp (afl_user,afl_user_text,afl_timestamp),
        KEY (afl_timestamp),
        KEY page_timestamp (afl_namespace, afl_title, afl_timestamp),
-       KEY ip_timestamp (afl_ip, afl_timestamp),
        KEY (afl_rev_id),
        KEY (afl_log_id),
        KEY wiki_timestamp (afl_wiki, afl_timestamp)
diff --git a/abusefilter.tables.sqlite.sql b/abusefilter.tables.sqlite.sql
index d0966cf..640afd1 100644
--- a/abusefilter.tables.sqlite.sql
+++ b/abusefilter.tables.sqlite.sql
@@ -32,7 +32,6 @@
        afl_filter varchar(64) binary NOT NULL,
        afl_user BIGINT unsigned NOT NULL,
        afl_user_text varchar(255) binary NOT NULL,
-       afl_ip varchar(255) not null,
        afl_action varbinary(255) not null,
        afl_actions varbinary(255) not null,
        afl_var_dump BLOB NOT NULL,
@@ -47,7 +46,6 @@
 CREATE INDEX afl_user_timestamp ON /*$wgDBprefix*/abuse_filter_log 
(afl_user,afl_user_text,afl_timestamp);
 CREATE INDEX afl_timestamp ON /*$wgDBprefix*/abuse_filter_log  (afl_timestamp);
 CREATE INDEX afl_page_timestamp ON /*$wgDBprefix*/abuse_filter_log 
(afl_namespace, afl_title, afl_timestamp);
-CREATE INDEX afl_ip_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_ip, 
afl_timestamp);
 CREATE INDEX afl_wiki_timestamp ON /*$wgDBprefix*/abuse_filter_log (afl_wiki, 
afl_timestamp);
 
 CREATE TABLE /*$wgDBprefix*/abuse_filter_history (
diff --git a/api/ApiQueryAbuseLog.php b/api/ApiQueryAbuseLog.php
index d0d43f9..1cf07dd 100644
--- a/api/ApiQueryAbuseLog.php
+++ b/api/ApiQueryAbuseLog.php
@@ -48,7 +48,6 @@
                $fld_ids = isset( $prop['ids'] );
                $fld_filter = isset( $prop['filter'] );
                $fld_user = isset( $prop['user'] );
-               $fld_ip = isset( $prop['ip'] );
                $fld_title = isset( $prop['title'] );
                $fld_action = isset( $prop['action'] );
                $fld_details = isset( $prop['details'] );
@@ -57,9 +56,6 @@
                $fld_hidden = isset( $prop['hidden'] );
                $fld_revid = isset( $prop['revid'] );
 
-               if ( $fld_ip && !$user->isAllowed( 'abusefilter-private' ) ) {
-                       $this->dieUsage( 'You don\'t have permission to view IP 
addresses', 'permissiondenied' );
-               }
                if ( $fld_details && !$user->isAllowed( 
'abusefilter-log-detail' ) ) {
                        $this->dieUsage( 'You don\'t have permission to view 
detailed abuse log entries', 'permissiondenied' );
                }
@@ -85,7 +81,6 @@
                $this->addFields( 'afl_filter' );
                $this->addFieldsIf( 'afl_id', $fld_ids );
                $this->addFieldsIf( 'afl_user_text', $fld_user );
-               $this->addFieldsIf( 'afl_ip', $fld_ip );
                $this->addFieldsIf( array( 'afl_namespace', 'afl_title' ), 
$fld_title );
                $this->addFieldsIf( 'afl_action', $fld_action );
                $this->addFieldsIf( 'afl_var_dump', $fld_details );
@@ -172,9 +167,6 @@
                        if ( $fld_user ) {
                                $entry['user'] = $row->afl_user_text;
                        }
-                       if ( $fld_ip ) {
-                               $entry['ip'] = $row->afl_ip;
-                       }
                        if ( $fld_title ) {
                                $title = Title::makeTitle( $row->afl_namespace, 
$row->afl_title );
                                ApiQueryBase::addTitleInfo( $entry, $title );
@@ -259,7 +251,6 @@
                                        'ids',
                                        'filter',
                                        'user',
-                                       'ip',
                                        'title',
                                        'action',
                                        'details',
@@ -296,7 +287,6 @@
                        array( 'code' => 'blocked', 'info' => 'You have been 
blocked from editing' ),
                        array( 'code' => 'permissiondenied', 'info' => 
'Permission denied' ),
                        array( 'code' => 'permissiondenied', 'info' => 'You 
don\'t have permission to view log entries for private filters'),
-                       array( 'code' => 'permissiondenied', 'info' => 'You 
don\'t have permission to view IP addresses' ),
                        array( 'code' => 'permissiondenied', 'info' => 'You 
don\'t have permission to view detailed abuse log entries' ),
                ) );
        }
diff --git a/special/SpecialAbuseLog.php b/special/SpecialAbuseLog.php
index fe45547..7ea4832 100644
--- a/special/SpecialAbuseLog.php
+++ b/special/SpecialAbuseLog.php
@@ -326,35 +326,6 @@
                // Build a table.
                $output .= AbuseFilter::buildVarDumpTable( $vars );
 
-               if ( self::canSeePrivate() ) {
-                       // Private stuff, like IPs.
-                       $header =
-                               Xml::element( 'th', null, $this->msg( 
'abusefilter-log-details-var' )->text() ) .
-                               Xml::element( 'th', null, $this->msg( 
'abusefilter-log-details-val' )->text() );
-                       $output .= Xml::element( 'h3', null, $this->msg( 
'abusefilter-log-details-private' )->text() );
-                       $output .=
-                               Xml::openElement( 'table',
-                                       array(
-                                               'class' => 'wikitable 
mw-abuselog-private',
-                                               'style' => 'width: 80%;'
-                                       )
-                               ) .
-                               Xml::openElement( 'tbody' );
-                       $output .= $header;
-
-                       // IP address
-                       $output .=
-                               Xml::tags( 'tr', null,
-                                       Xml::element( 'td',
-                                               array( 'style' => 'width: 30%;' 
),
-                                               $this->msg( 
'abusefilter-log-details-ip' )->text()
-                                       ) .
-                                       Xml::element( 'td', null, $row->afl_ip )
-                               );
-
-                       $output .= Xml::closeElement( 'tbody' ) . 
Xml::closeElement( 'table' );
-               }
-
                $output = Xml::tags( 'fieldset', null, $output );
 
                $out->addHTML( $output );

-- 
To view, visit https://gerrit.wikimedia.org/r/73532
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2aa82db2a1b42fd8379ae5e810e38c1575f0225
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>

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

Reply via email to