mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-24 00:13:27 +00:00
Make PageImages default API license parameter configurable
Bug: T156190 Change-Id: Id4b43f2597d5a063dca0d46f308b6283620e9974
This commit is contained in:
parent
88329411c7
commit
97572615e0
|
@ -88,6 +88,10 @@
|
|||
"@doc": "Temporary feature flag - Whether page images should be restricted to those in section id 0.",
|
||||
"@fixme": "Please remove a month after it has defaulted to true on the cluster (T152115)",
|
||||
"value": true
|
||||
},
|
||||
"PageImagesAPIDefaultLicense": {
|
||||
"@doc": "Get images with either a 'free' license or 'any' (including free and non-free) license by default, via 'pilicense' option, in pageprops query api. The value of this setting should be either 'free' or 'any'.",
|
||||
"value": "free"
|
||||
}
|
||||
},
|
||||
"manifest_version": 2
|
||||
|
|
|
@ -264,7 +264,7 @@ class ApiQueryPageImages extends ApiQueryBase {
|
|||
'license' => [
|
||||
ApiBase::PARAM_TYPE => [ self::PARAM_LICENSE_FREE, self::PARAM_LICENSE_ANY ],
|
||||
ApiBase::PARAM_ISMULTI => false,
|
||||
ApiBase::PARAM_DFLT => self::PARAM_LICENSE_FREE,
|
||||
ApiBase::PARAM_DFLT => $this->getConfig()->get( 'PageImagesAPIDefaultLicense' ),
|
||||
],
|
||||
'continue' => [
|
||||
ApiBase::PARAM_TYPE => 'integer',
|
||||
|
|
|
@ -59,10 +59,18 @@ class ApiQueryPageImagesProxy extends ApiQueryPageImages {
|
|||
class ApiQueryPageImagesTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
private function newInstance() {
|
||||
$config = new \HashConfig( [
|
||||
'PageImagesAPIDefaultLicense' => 'free'
|
||||
]);
|
||||
|
||||
$context = $this->getMockBuilder( 'IContextSource' )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$context->expects( $this->any() )
|
||||
->method( 'getConfig' )
|
||||
->willReturn( $config );
|
||||
|
||||
$main = $this->getMockBuilder( 'ApiMain' )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
|
Loading…
Reference in a new issue