From: Roan Kattouw Date: Mon, 3 Mar 2008 11:29:49 +0000 (+0000) Subject: API: Adding $wgAPIUCUserPrefixMinLength config variable to close a DOS window X-Git-Tag: 1.31.0-rc.0~49274 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=aa91ab36c15212af9568160692dda23da3f15609;p=lhc%2Fweb%2Fwiklou.git API: Adding $wgAPIUCUserPrefixMinLength config variable to close a DOS window --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 467ce3d726..b955d8662e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2873,6 +2873,12 @@ $wgEnableWriteAPI = false; */ $wgAPIModules = array(); +/** + * Minimum length of list=usercontribs's ucuserprefix parameter + * Setting this to a low value can open DOS windows on large wikis + */ +$wgAPIUCUserPrefixMinLength = 3; + /** * Parser test suite files to be run by parserTests.php when no specific * filename is passed to it. diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 1f589e3554..59a469f536 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -62,6 +62,10 @@ class ApiQueryContributions extends ApiQueryBase { if(isset($this->params['userprefix'])) { + global $wgAPIUCUserPrefixMinLength; + if(strlen($this->params['userprefix']) < $wgAPIUCUserPrefixMinLength) + $this->dieUsage("User prefixes must be at least $wgAPIUCUserPrefixMinLength characters", 'userprefix-tooshort'); + $this->prefixMode = true; $this->userprefix = $this->params['userprefix']; }