public function setConfig(Config $config) { parent::setConfig($config); // @codeCoverageIgnoreStart $this->throttleSettings += ['accountCreationThrottle' => [['count' => $this->config->get('AccountCreationThrottle'), 'seconds' => 86400]], 'passwordAttemptThrottle' => $this->config->get('PasswordAttemptThrottle')]; if (!empty($this->throttleSettings['accountCreationThrottle'])) { $this->accountCreationThrottle = new Throttler($this->throttleSettings['accountCreationThrottle'], ['type' => 'acctcreate', 'cache' => $this->cache]); } if (!empty($this->throttleSettings['passwordAttemptThrottle'])) { $this->passwordAttemptThrottle = new Throttler($this->throttleSettings['passwordAttemptThrottle'], ['type' => 'password', 'cache' => $this->cache]); } }
public function setConfig(Config $config) { parent::setConfig($config); $accountCreationThrottle = $this->config->get('AccountCreationThrottle'); // Handle old $wgAccountCreationThrottle format (number of attempts per 24 hours) if (!is_array($accountCreationThrottle)) { $accountCreationThrottle = [['count' => $accountCreationThrottle, 'seconds' => 86400]]; } // @codeCoverageIgnoreStart $this->throttleSettings += ['accountCreationThrottle' => $accountCreationThrottle, 'passwordAttemptThrottle' => $this->config->get('PasswordAttemptThrottle')]; if (!empty($this->throttleSettings['accountCreationThrottle'])) { $this->accountCreationThrottle = new Throttler($this->throttleSettings['accountCreationThrottle'], ['type' => 'acctcreate', 'cache' => $this->cache]); } if (!empty($this->throttleSettings['passwordAttemptThrottle'])) { $this->passwordAttemptThrottle = new Throttler($this->throttleSettings['passwordAttemptThrottle'], ['type' => 'password', 'cache' => $this->cache]); } }