Jjanes has uploaded a new change for review.

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

Change subject: PostgreSQL: Fix magic-value code for AbuseFilter
......................................................................

PostgreSQL: Fix magic-value code for AbuseFilter

When importing filters, the code is using the magic value
of 'new' for the af_id field, which is of type bigint, to
indicate a not-yet-inserted record.

In MySQL, comparing a bigint to 'new' is legal but always false,
while in PostgreSQL it is illegal, and led to errors when checking
if the filter is hidden.

Fix this by adding special-case code to filterHidden so that it
always returns false for 'new' records.  In PostreSQL this fixes
the error, and in MySQL it avoids a pointless trip to the database.

Should be back patched to 1.23 and 1.24

Bug: T89514
Change-Id: Ib4b5585ac9889a1760ec930c555e7809a424538e
---
M AbuseFilter.class.php
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/AbuseFilter.class.php b/AbuseFilter.class.php
index 70d20d6..0202a0b 100644
--- a/AbuseFilter.class.php
+++ b/AbuseFilter.class.php
@@ -277,6 +277,9 @@
                } else {
                        $dbr = wfGetDB( DB_SLAVE );
                }
+               if ( $filter === 'new' ) {
+                       return false;
+               };
                $hidden = $dbr->selectField(
                        'abuse_filter',
                        'af_hidden',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4b5585ac9889a1760ec930c555e7809a424538e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Jjanes <jeff.ja...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to