Cache global filter names

AbuseLog fetches the names in an additional query for each line but the
result is always same.

Change-Id: Ie12f909727ae82ab60781ccedfdf1b241c105388
This commit is contained in:
Matěj Suchánek 2016-12-26 10:09:37 +00:00
parent 0f47be6d93
commit a1aa09d31c

View file

@ -2408,14 +2408,21 @@ class AbuseFilter {
return '';
}
static $cache = [];
if ( isset( $cache[$filterID] ) ) {
return $cache[$filterID];
}
$fdb = wfGetDB( DB_SLAVE, [], $wgAbuseFilterCentralDB );
return $fdb->selectField(
$cache[$filterID] = $fdb->selectField(
'abuse_filter',
'af_public_comments',
[ 'af_id' => $filterID ],
__METHOD__
);
return $cache[$filterID];
}
/**