# Validate entry, skip when it does not apply to our case # 1) skip when it does not apply to our database name if (isset($options['dbname']) && !in_array($wgDBname, (array) $options['dbname'])) { continue; } # 2) skip expired entries $inTimeWindow = time() >= strtotime($options['from']) && time() <= strtotime($options['to']); if (!$inTimeWindow) { continue; } # 3) skip when throttle does not apply to the client IP $ip = $wgRequest->getIP(); if (isset($options['IP']) && !in_array($ip, (array) $options['IP'])) { continue; } if (isset($options['range']) && !IP::isInRanges($ip, (array) $options['range'])) { continue; } # Finally) set up the throttle value global $wgAccountCreationThrottle, $wgRateLimits; if (isset($options['value']) && is_numeric($options['value'])) { $wgAccountCreationThrottle = $options['value']; } else { $wgAccountCreationThrottle = 50; // Provide some sane default } $wgRateLimits['badcaptcha']['ip'] = array(1000, 86400); $wgRateLimits['badcaptcha']['newbie'] = array(1000, 86400); return; # No point in proceeding to another entry }