mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-24 00:13:27 +00:00
Only provide free images for search purposes
Bug: T320661 Change-Id: Ic26e7e815365f6aa81b6fbfb464d0f41b80e4ae8
This commit is contained in:
parent
f807a8bbf0
commit
5dcd4d13e2
|
@ -52,7 +52,8 @@ class SearchResultProvideThumbnailHookHandler implements SearchResultProvideThum
|
|||
|
||||
$propValues = $this->pageProps->getProperties(
|
||||
$nonFileIdentitiesByPageId,
|
||||
PageImages::getPropNames( PageImages::LICENSE_ANY )
|
||||
// T320661: only provide free images for search purposes
|
||||
PageImages::getPropNames( PageImages::LICENSE_FREE )
|
||||
);
|
||||
$fileNames = array_map( static function ( $prop ) {
|
||||
return $prop[ PageImages::getPropName( false ) ]
|
||||
|
|
|
@ -116,14 +116,13 @@ class SearchResultProvideThumbnailHookHandlerTest extends MediaWikiIntegrationTe
|
|||
->method( 'getProperties' )
|
||||
->with(
|
||||
$this->anything(),
|
||||
PageImages::getPropNames( PageImages::LICENSE_ANY )
|
||||
PageImages::getPropNames( PageImages::LICENSE_FREE )
|
||||
)->willReturn( [
|
||||
1 => [
|
||||
PageImages::getPropName( true ) => 'File1.jpg'
|
||||
PageImages::getPropName( true ) => 'File1_free.jpg'
|
||||
],
|
||||
2 => [
|
||||
PageImages::getPropName( true ) => 'File2_free.jpg',
|
||||
PageImages::getPropName( false ) => 'File2_any.jpg'
|
||||
] ] );
|
||||
|
||||
$repoGroup = $this->getMockBuilder( RepoGroup::class )
|
||||
|
@ -140,7 +139,7 @@ class SearchResultProvideThumbnailHookHandlerTest extends MediaWikiIntegrationTe
|
|||
};
|
||||
$repoGroup->expects( $this->exactly( 2 ) )
|
||||
->method( 'findFile' )
|
||||
->withConsecutive( [ 'File1.jpg' ], [ 'File2_any.jpg' ] )
|
||||
->withConsecutive( [ 'File1_free.jpg' ], [ 'File2_free.jpg' ] )
|
||||
->willReturnOnConsecutiveCalls(
|
||||
new ReturnCallback( $findFileCallback ),
|
||||
null
|
||||
|
@ -157,7 +156,7 @@ class SearchResultProvideThumbnailHookHandlerTest extends MediaWikiIntegrationTe
|
|||
$this->assertNull( $results[ 4 ] );
|
||||
|
||||
$this->assertNotNull( $results[ 1 ] );
|
||||
$this->assertSame( 'File1.jpg', $results[ 1 ]->getName() );
|
||||
$this->assertSame( 'File1_free.jpg', $results[ 1 ]->getName() );
|
||||
$this->assertSame(
|
||||
SearchResultThumbnailProvider::THUMBNAIL_SIZE,
|
||||
$results[ 1 ]->getWidth()
|
||||
|
|
Loading…
Reference in a new issue