33 $this->repoGroup = $repoGroup;
34 $this->hookRunner =
new HookRunner( $hookContainer );
44 private function getFileNamesByPageId( array $identitiesByPageId ): array {
45 $fileIdentitiesByPageId = array_filter(
48 return $pageIdentity->getNamespace() ===
NS_FILE;
53 static function ( PageIdentity $pageIdentity ) {
54 return $pageIdentity->getDBkey();
56 $fileIdentitiesByPageId
68 $size ??= self::THUMBNAIL_SIZE;
70 $thumb = $file->
transform( [
'width' => $size ] );
71 if ( !$thumb || $thumb->isError() ) {
77 $thumb->getFile()->getMimeType(),
92 public function getThumbnails( array $pageIdentities, ?
int $size = 60 ): array {
94 $fileNamesByPageId = $this->getFileNamesByPageId( $pageIdentities );
96 foreach ( $fileNamesByPageId as $pageId => $fileName ) {
97 $file = $this->repoGroup->findFile( $fileName );
101 $thumbnail = $this->buildSearchResultThumbnailFromFile( $file, $size );
103 $results[$pageId] = $thumbnail;
108 $this->hookRunner->onSearchResultProvideThumbnail( $pageIdentities, $results, $size );
Implements some public methods and some protected utility functions which are required by multiple ch...
getName()
Return the name of this file.
transform( $params, $flags=0)
Transform a media file.
Prioritized list of file repositories.
Interface for objects (potentially) representing an editable wiki page.