62 parent::__construct(
'MIMEsearch' );
81 return [
'mime' =>
"{$this->major}/{$this->minor}" ];
86 if ( $this->minor !==
'*' ) {
90 $imgQuery = LocalFile::getQueryInfo();
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',
159 HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() )
160 ->setSubmitTextMsg(
'ilsubmit' )
164 ->displayForm(
false );
169 $queryBuilder = $this->
getDatabaseProvider()->getReplicaDatabase()->newSelectQueryBuilder();
173 ->select( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] )
175 ->groupBy( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] );
176 $result = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
180 foreach ( $result as $row ) {
181 $major = $row->img_major_mime;
182 $minor = $row->img_minor_mime;
183 $suggestions[
"$major/$minor" ] =
"$major/$minor";
184 if ( $lastMajor ===
$major ) {
186 $suggestions[
"$major/*" ] =
"$major/*";
190 ksort( $suggestions );
196 $this->mime = $par ?: $this->
getRequest()->getText(
'mime' );
197 $this->mime = trim( $this->mime );
201 if ( $this->major ==
'' || $this->minor ==
'' || $this->minor ==
'unknown' ||
202 !$mimeAnalyzer->isValidMajorMimeType( $this->major )
210 parent::execute( $par );
220 $nt = Title::makeTitle( $result->namespace, $result->title );
222 $text = $this->languageConverter->convertHtml( $nt->getText() );
223 $plink = $linkRenderer->makeLink(
224 Title::newFromText( $nt->getPrefixedText() ),
228 $download = Linker::makeMediaLinkObj( $nt, $this->
msg(
'download' )->escaped() );
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(
235 Title::makeTitle(
NS_USER, $result->img_user_text ),
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";
258class_alias( SpecialMIMESearch::class,
'SpecialMIMESearch' );
Implements some public methods and some protected utility functions which are required by multiple ch...
Marks HTML that shouldn't be escaped.
Local file in the wiki's own database.
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)
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getPageTitle( $subpage=false)
Get a self-referential title object.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getContentLanguage()
Shortcut to get content language.
getLanguage()
Shortcut to get user's language.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
The base class for all skins.
The shared interface for all language converters.
const MEDIATYPE_MULTIMEDIA
const MEDIATYPE_EXECUTABLE