r49751 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49750‎ | r49751 | r49752 >
Date:03:37, 23 April 2009
Author:werdna
Status:ok
Tags:
Comment:
Merge in r49312 from preferences-work -- non preference related performance improvement to the AbuseFilter parser
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.parser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php
@@ -1433,16 +1433,20 @@
14341434 }
14351435
14361436 protected function ccnorm( $s ) {
1437 - if (!class_exists( 'AntiSpoof' ) ) {
1438 - return $s;
 1437+ static $equivset = null;
 1438+
 1439+ if ( is_null( $equivset ) ) {
 1440+ global $IP;
 1441+ require( "$IP/extensions/AntiSpoof/equivset.php" );
14391442 }
14401443
1441 - // Normalise confusable characters.
1442 - $chars = AntiSpoof::stringToList( $s );
1443 - $chars = AntiSpoof::equivString( $chars );
1444 - $s = AntiSpoof::listToString( $chars );
1445 -
1446 - return $s;
 1444+ if (function_exists('fss_prep_replace')) {
 1445+ $fss = fss_prep_replace( $equivset );
 1446+
 1447+ return fss_exec_replace( $fss, $s );
 1448+ } else {
 1449+ return strtr( $s, $equivset );
 1450+ }
14471451 }
14481452
14491453 protected function rmspecials( $s ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49312Replace existing ccnorm one with one that makes use of faststringsearch where...werdna13:05, 8 April 2009

Status & tagging log