25 namespace MediaWiki\Specials;
50 private $languageConverter;
62 parent::__construct(
'MIMEsearch' );
81 return [
'mime' =>
"{$this->major}/{$this->minor}" ];
86 if ( $this->minor !==
'*' ) {
92 'tables' => $imgQuery[
'tables'],
95 'title' =>
'img_name',
98 'value' =>
'img_name',
102 'img_user_text' => $imgQuery[
'fields'][
'img_user_text'],
110 'img_media_type' => [
124 'join_conds' => $imgQuery[
'joins'],
150 'type' =>
'combobox',
153 'label-message' =>
'mimetype',
160 ->setSubmitTextMsg(
'ilsubmit' )
164 ->displayForm(
false );
172 $result =
$dbr->select(
176 [
'img_media_type',
'img_major_mime',
'img_minor_mime' ],
179 [
'GROUP BY' => [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] ]
181 foreach ( $result as $row ) {
182 $major = $row->img_major_mime;
183 $minor = $row->img_minor_mime;
184 $suggestions[
"$major/$minor" ] =
"$major/$minor";
185 if ( $lastMajor ===
$major ) {
187 $suggestions[
"$major/*" ] =
"$major/*";
191 ksort( $suggestions );
197 $this->mime = $par ?: $this->
getRequest()->getText(
'mime' );
198 $this->mime = trim( $this->mime );
201 if ( $this->major ==
'' || $this->minor ==
'' || $this->minor ==
'unknown' ||
202 !self::isValidType( $this->major )
210 parent::execute( $par );
222 $text = $this->languageConverter->convertHtml( $nt->getText() );
223 $plink = $linkRenderer->makeLink(
229 $download = $this->
msg(
'parentheses' )->rawParams( $download )->escaped();
231 $bytes = htmlspecialchars(
$lang->formatSize( $result->img_size ) );
232 $dimensions = $this->
msg(
'widthheight' )->numParams( $result->img_width,
233 $result->img_height )->escaped();
234 $user = $linkRenderer->makeLink(
236 $result->img_user_text
239 $time =
$lang->userTimeAndDate( $result->img_timestamp, $this->getUser() );
240 $time = htmlspecialchars( $time );
242 return "$download $plink . . $dimensions . . $bytes . . $user . . $time";
264 return in_array(
$type, $types );
280 class_alias( SpecialMIMESearch::class,
'SpecialMIMESearch' );
Implements some public methods and some protected utility functions which are required by multiple ch...
static splitMime(?string $mime)
Split an internet media type into its two components; if not a two-part name, set the minor type to '...
Marks HTML that shouldn't be escaped.
Local file in the wiki's own database.
static getQueryInfo(array $options=[])
Return the tables, fields, and join conditions to be selected to create a new localfile object.
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
setDatabaseProvider(IConnectionProvider $databaseProvider)
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
The main skin class which provides methods and properties for all other skins.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getContentLanguage()
Shortcut to get content language.
The shared interface for all language converters.
const MEDIATYPE_MULTIMEDIA
const MEDIATYPE_EXECUTABLE
if(!isset( $args[0])) $lang