Dmaza has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371205 )

Change subject: Remove manual implementation of AntiSpoof::equivString
......................................................................

Remove manual implementation of AntiSpoof::equivString

Cleaned ccnorm method to use AntiSpoof::normalizeString instead going
after AntiSpoof extension files and doing a manual implementation of it.
Also removed composer requirement for AntiSpoof extension.

Bug: T172766
Depends-On: I731733671b650b6bb2f480c41c4f6f2d2f5c62e8
Change-Id: Ib38ba0b06918e81e8af03032eef95e3942773bc1
---
M composer.json
M includes/parser/AbuseFilterParser.php
2 files changed, 10 insertions(+), 28 deletions(-)


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

diff --git a/composer.json b/composer.json
index 485f881..ebfd697 100644
--- a/composer.json
+++ b/composer.json
@@ -6,8 +6,7 @@
        "license": "GPL-2.0+",
        "require": {
                "php": ">=5.4",
-               "composer/installers": "1.*,>=1.0.1",
-               "mediawiki/anti-spoof": "dev-master"
+               "composer/installers": "1.*,>=1.0.1"
        },
        "require-dev": {
                "jakub-onderka/php-parallel-lint": "0.9.2",
diff --git a/includes/parser/AbuseFilterParser.php 
b/includes/parser/AbuseFilterParser.php
index 097e248..fc4528e 100644
--- a/includes/parser/AbuseFilterParser.php
+++ b/includes/parser/AbuseFilterParser.php
@@ -1106,34 +1106,17 @@
         * @return mixed
         */
        protected function ccnorm( $s ) {
-               static $replacementArray = null;
-
-               if ( is_null( $replacementArray ) ) {
-                       global $wgExtensionDirectory;
-
-                       if ( is_readable( 
"$wgExtensionDirectory/AntiSpoof/equivset.php" ) ) {
-                               // Satisfy analyzer.
-                               $equivset = null;
-                               // Contains a map of characters in $equivset.
-                               require 
"$wgExtensionDirectory/AntiSpoof/equivset.php";
-
-                               // strtr in ReplacementArray->replace() doesn't 
like this.
-                               if ( isset( $equivset[''] ) ) {
-                                       unset( $equivset[''] );
-                               }
-
-                               $replacementArray = new ReplacementArray( 
$equivset );
-                       } else {
-                               // AntiSpoof isn't available, so just create a 
dummy
-                               wfDebugLog(
-                                       'AbuseFilter',
-                                       "Can't compute normalized string 
(ccnorm) as the AntiSpoof Extension isn't installed."
-                               );
-                               $replacementArray = new ReplacementArray( [] );
-                       }
+               if ( is_callable( [ 'AntiSpoof' , 'normalizeString' ] ) ) {
+                       $s = AntiSpoof::normalizeString( $s );
+               } else {
+                       // AntiSpoof isn't available, so ignore and return same 
string
+                       wfDebugLog(
+                               'AbuseFilter',
+                               "Can't compute normalized string (ccnorm) as 
the AntiSpoof Extension isn't installed."
+                       );
                }
 
-               return $replacementArray->replace( $s );
+               return $s;
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib38ba0b06918e81e8af03032eef95e3942773bc1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Dmaza <dm...@wikimedia.org>

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

Reply via email to