61 parent::__construct(
'MIMEsearch' );
80 return [
'mime' =>
"{$this->major}/{$this->minor}" ];
85 if ( $this->minor !==
'*' ) {
89 $fileQuery = FileSelectQueryBuilder::newForFile( $this->
getDatabaseProvider()->getReplicaDatabase() )
92 'tables' => $fileQuery[
'tables'],
95 'title' =>
'img_name',
98 'value' =>
'img_name',
109 'img_media_type' => [
123 'join_conds' => $fileQuery[
'join_conds'],
126 if ( isset( $fileQuery[
'fields'][
'img_user_text'] ) ) {
127 $qi[
'fields'][
'img_user_text'] = $fileQuery[
'fields'][
'img_user_text'];
130 $qi[
'fields'][] =
'img_user_text';
156 'type' =>
'combobox',
159 'label-message' =>
'mimetype',
165 HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() )
166 ->setSubmitTextMsg(
'ilsubmit' )
170 ->displayForm(
false );
175 $queryBuilder = $this->
getDatabaseProvider()->getReplicaDatabase()->newSelectQueryBuilder();
183 ->select( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] )
185 ->groupBy( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] );
187 $queryBuilder->select(
189 'img_media_type' =>
'ft_media_type',
190 'img_major_mime' =>
'ft_major_mime',
191 'img_minor_mime' =>
'ft_minor_mime',
194 ->from(
'filetypes' );
197 $result = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
201 foreach ( $result as $row ) {
202 $major = $row->img_major_mime;
203 $minor = $row->img_minor_mime;
204 $suggestions[
"$major/$minor" ] =
"$major/$minor";
205 if ( $lastMajor ===
$major ) {
207 $suggestions[
"$major/*" ] =
"$major/*";
211 ksort( $suggestions );
217 $this->mime = $par ?: $this->
getRequest()->getText(
'mime' );
218 $this->mime = trim( $this->mime );
222 if ( $this->major ==
'' || $this->minor ==
'' || $this->minor ==
'unknown' ||
223 !$mimeAnalyzer->isValidMajorMimeType( $this->major )
231 parent::execute( $par );
241 $nt = Title::makeTitle( $result->namespace, $result->title );
243 $text = $this->languageConverter->convertHtml( $nt->getText() );
244 $plink = $linkRenderer->makeLink(
245 Title::newFromText( $nt->getPrefixedText() ),
249 $download = Linker::makeMediaLinkObj( $nt, $this->
msg(
'download' )->escaped() );
250 $download = $this->
msg(
'parentheses' )->rawParams( $download )->escaped();
252 $bytes = htmlspecialchars( $lang->formatSize( $result->img_size ) );
253 $dimensions = $this->
msg(
'widthheight' )->numParams( $result->img_width,
254 $result->img_height )->escaped();
255 $user = $linkRenderer->makeLink(
256 Title::makeTitle(
NS_USER, $result->img_user_text ),
257 $result->img_user_text
260 $time = $lang->userTimeAndDate( $result->img_timestamp, $this->getUser() );
261 $time = htmlspecialchars( $time );
263 return "$download $plink . . $dimensions . . $bytes . . $user . . $time";
279class_alias( SpecialMIMESearch::class,
'SpecialMIMESearch' );
const SCHEMA_COMPAT_READ_OLD
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.
const MEDIATYPE_MULTIMEDIA
const MEDIATYPE_EXECUTABLE