66 parent::__construct(
'MIMEsearch' );
85 return [
'mime' =>
"{$this->major}/{$this->minor}" ];
90 if ( $this->minor !==
'*' ) {
94 $fileQuery = FileSelectQueryBuilder::newForFile( $this->
getDatabaseProvider()->getReplicaDatabase() )
97 'tables' => $fileQuery[
'tables'],
100 'title' =>
'img_name',
103 'value' =>
'img_name',
114 'img_media_type' => [
128 'join_conds' => $fileQuery[
'join_conds'],
131 if ( isset( $fileQuery[
'fields'][
'img_user_text'] ) ) {
132 $qi[
'fields'][
'img_user_text'] = $fileQuery[
'fields'][
'img_user_text'];
135 $qi[
'fields'][] =
'img_user_text';
161 'type' =>
'combobox',
164 'label-message' =>
'mimetype',
170 HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() )
171 ->setSubmitTextMsg(
'ilsubmit' )
175 ->displayForm(
false );
180 $queryBuilder = $this->
getDatabaseProvider()->getReplicaDatabase()->newSelectQueryBuilder();
188 ->select( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] )
190 ->groupBy( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] );
192 $queryBuilder->select(
194 'img_media_type' =>
'ft_media_type',
195 'img_major_mime' =>
'ft_major_mime',
196 'img_minor_mime' =>
'ft_minor_mime',
199 ->from(
'filetypes' );
202 $result = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
206 foreach ( $result as $row ) {
207 $major = $row->img_major_mime;
208 $minor = $row->img_minor_mime;
209 $suggestions[
"$major/$minor" ] =
"$major/$minor";
210 if ( $lastMajor ===
$major ) {
212 $suggestions[
"$major/*" ] =
"$major/*";
216 ksort( $suggestions );
222 $this->mime = $par ?: $this->
getRequest()->getText(
'mime' );
223 $this->mime = trim( $this->mime );
227 if ( $this->major ==
'' || $this->minor ==
'' || $this->minor ==
'unknown' ||
228 !$mimeAnalyzer->isValidMajorMimeType( $this->major )
236 parent::execute( $par );
246 $nt = Title::makeTitle( $result->namespace, $result->title );
248 $text = $this->languageConverter->convertHtml( $nt->getText() );
249 $plink = $linkRenderer->makeLink(
250 Title::newFromText( $nt->getPrefixedText() ),
254 $download = Linker::makeMediaLinkObj( $nt, $this->
msg(
'download' )->escaped() );
255 $download = $this->
msg(
'parentheses' )->rawParams( $download )->escaped();
257 $bytes = htmlspecialchars( $lang->formatSize( $result->img_size ) );
258 $dimensions = $this->
msg(
'widthheight' )->numParams( $result->img_width,
259 $result->img_height )->escaped();
260 $user = $linkRenderer->makeLink(
261 Title::makeTitle(
NS_USER, $result->img_user_text ),
262 $result->img_user_text
265 $time = $lang->userTimeAndDate( $result->img_timestamp, $this->getUser() );
266 $time = htmlspecialchars( $time );
268 return "$download $plink . . $dimensions . . $bytes . . $user . . $time";
284class_alias( SpecialMIMESearch::class,
'SpecialMIMESearch' );
const SCHEMA_COMPAT_READ_OLD
Implements some public methods and some protected utility functions which are required by multiple ch...
Marks HTML that shouldn't be escaped.
A class containing constants representing the names of configuration variables.
const FileSchemaMigrationStage
Name constant for the FileSchemaMigrationStage setting, for use with Config::get()
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 By default the message key is the canonical name of...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
The base class for all skins.
const MEDIATYPE_MULTIMEDIA
const MEDIATYPE_EXECUTABLE