mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Merge "Add missing limits to explode() calls"
This commit is contained in:
commit
c52850aae7
|
@ -2356,9 +2356,7 @@ class AbuseFilter {
|
|||
* @return null|string Null on success, a string with the error message on failure
|
||||
*/
|
||||
public static function checkThrottleParameters( $params ) {
|
||||
$throttleRate = explode( ',', $params[1] );
|
||||
$throttleCount = $throttleRate[0];
|
||||
$throttlePeriod = $throttleRate[1];
|
||||
list( $throttleCount, $throttlePeriod ) = explode( ',', $params[1], 2 );
|
||||
$throttleGroups = array_slice( $params, 2 );
|
||||
$validGroups = [
|
||||
'ip',
|
||||
|
|
|
@ -527,12 +527,9 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
$throttleFields = [];
|
||||
|
||||
if ( $set ) {
|
||||
array_shift( $parameters );
|
||||
$throttleRate = explode( ',', $parameters[0] );
|
||||
$throttleCount = $throttleRate[0];
|
||||
$throttlePeriod = $throttleRate[1];
|
||||
list( $throttleCount, $throttlePeriod ) = explode( ',', $parameters[1], 2 );
|
||||
|
||||
$throttleGroups = array_slice( $parameters, 1 );
|
||||
$throttleGroups = array_slice( $parameters, 2 );
|
||||
} else {
|
||||
$throttleCount = 3;
|
||||
$throttlePeriod = 60;
|
||||
|
|
|
@ -61,8 +61,7 @@ class AddMissingLoggingEntries extends Maintenance {
|
|||
|
||||
foreach ( $logResult as $row ) {
|
||||
// id . '\n' . filter
|
||||
$params = explode( "\n", $row->log_params );
|
||||
// id
|
||||
$params = explode( "\n", $row->log_params, 2 );
|
||||
$afhId = $params[0];
|
||||
// Forget this row had any issues - it just has a different timestamp in the log
|
||||
unset( $afhRows[$afhId] );
|
||||
|
|
|
@ -664,6 +664,7 @@ class AbuseFilterSaveTest extends MediaWikiTestCase {
|
|||
[ [ '1', '-3,23', 'user', 'ip' ], 'abusefilter-edit-invalid-throttlecount' ],
|
||||
[ [ '1', '5,2.3', 'user', 'ip' ], 'abusefilter-edit-invalid-throttleperiod' ],
|
||||
[ [ '1', '4,-14', 'user', 'ip' ], 'abusefilter-edit-invalid-throttleperiod' ],
|
||||
[ [ '1', '3,33,44', 'user', 'ip' ], 'abusefilter-edit-invalid-throttleperiod' ],
|
||||
[ [ '1', '3,33' ], 'abusefilter-edit-empty-throttlegroups' ],
|
||||
[ [ '1', '3,33', 'user', 'ip,foo,user' ], 'abusefilter-edit-invalid-throttlegroups' ],
|
||||
[ [ '1', '3,33', 'foo', 'ip,user' ], 'abusefilter-edit-invalid-throttlegroups' ],
|
||||
|
|
Loading…
Reference in a new issue