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:
Marius Hoch 2013-07-02 03:55:53 +02:00
parent cf190f71a2
commit 9823d78e3b

View file

@ -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 );