From: Thalia Date: Mon, 17 Dec 2018 17:53:27 +0000 (+0000) Subject: Set API limits for page restrictions to 10 X-Git-Tag: 1.34.0-rc.0~3239 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=9c8e1aaa4c0bb52339aef2f4053743355e13fc4e;p=lhc%2Fweb%2Fwiklou.git Set API limits for page restrictions to 10 Bug: T212142 Change-Id: Ide0f2f86df2101194155be53a4b9012ddefbbcaf --- diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 3581ac8514..8976626a57 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -57,20 +57,6 @@ class ApiBlock extends ApiBase { $editingRestriction = 'sitewide'; $pageRestrictions = ''; if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) { - if ( $params['pagerestrictions'] ) { - $count = count( $params['pagerestrictions'] ); - if ( $count > 10 ) { - $this->dieWithError( - $this->msg( - 'apierror-integeroutofrange-abovebotmax', - 'pagerestrictions', - 10, - $count - ) - ); - } - } - if ( $params['partial'] ) { $editingRestriction = 'partial'; } @@ -207,6 +193,8 @@ class ApiBlock extends ApiBase { $params['partial'] = false; $params['pagerestrictions'] = [ ApiBase::PARAM_ISMULTI => true, + ApiBase::PARAM_ISMULTI_LIMIT1 => 10, + ApiBase::PARAM_ISMULTI_LIMIT2 => 10, ]; } diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index 9898e535e0..e229f0c106 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -274,7 +274,8 @@ class ApiBlockTest extends ApiTestCase { /** * @expectedException ApiUsageException - * @expectedExceptionMessage "pagerestrictions" may not be over 10 (set to 11) for bots or sysops. + * @expectedExceptionMessage Too many values supplied for parameter "pagerestrictions". The + * limit is 10. */ public function testBlockingToManyRestrictions() { $this->setMwGlobals( [