mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Make AbuseFilter work without AntiSpoof
This dependency isn't really needed in many cases while it can cause troubles if not fulfilled. Change-Id: I9990e99c4d3d49b5bc400bbc4a0ec02142d6f055
This commit is contained in:
parent
cf190f71a2
commit
9823d78e3b
|
@ -1926,13 +1926,21 @@ class AbuseFilterParser {
|
|||
* @return mixed
|
||||
*/
|
||||
protected function ccnorm( $s ) {
|
||||
static $equivset = null;
|
||||
static $replacementArray = null;
|
||||
|
||||
if ( is_null( $equivset ) || is_null( $replacementArray ) ) {
|
||||
if ( is_null( $replacementArray ) ) {
|
||||
global $IP;
|
||||
require_once( "$IP/extensions/AntiSpoof/equivset.php" );
|
||||
$replacementArray = new ReplacementArray( $equivset );
|
||||
if ( is_readable( "$IP/extensions/AntiSpoof/equivset.php" ) ) {
|
||||
require "$IP/extensions/AntiSpoof/equivset.php";
|
||||
$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 isntalled."
|
||||
);
|
||||
$replacementArray = new ReplacementArray( array() );
|
||||
}
|
||||
}
|
||||
|
||||
return $replacementArray->replace( $s );
|
||||
|
|
Loading…
Reference in a new issue