3 namespace MediaWiki\Search;
32 $this->repoGroup = $repoGroup;
33 $this->hookRunner =
new HookRunner( $hookContainer );
43 private function getFileNamesByPageId( array $identitiesByPageId ): array {
44 $fileIdentitiesByPageId = array_filter(
55 $fileIdentitiesByPageId
67 $size ??= self::THUMBNAIL_SIZE;
69 $thumb =
$file->transform( [
'width' => $size ] );
70 if ( !$thumb || $thumb->isError() ) {
75 $thumb->getFile()->getMimeType(),
90 public function getThumbnails( array $pageIdentities, ?
int $size = 60 ): array {
92 $fileNamesByPageId = $this->getFileNamesByPageId( $pageIdentities );
94 foreach ( $fileNamesByPageId as $pageId => $fileName ) {
95 $file = $this->repoGroup->findFile( $fileName );
99 $thumbnail = $this->buildSearchResultThumbnailFromFile(
$file, $size );
101 $results[$pageId] = $thumbnail;
106 $this->hookRunner->onSearchResultProvideThumbnail( $pageIdentities, $results, $size );
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL using $wgServer (or one of its alternatives).
Implements some public methods and some protected utility functions which are required by multiple ch...
Prioritized list of file repositories.
Interface for objects (potentially) representing an editable wiki page.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.