64 parent::__construct(
'MIMEsearch' );
83 return [
'mime' =>
"{$this->major}/{$this->minor}" ];
88 if ( $this->minor !==
'*' ) {
92 $imgQuery = LocalFile::getQueryInfo();
94 'tables' => $imgQuery[
'tables'],
97 'title' =>
'img_name',
100 'value' =>
'img_name',
104 'img_user_text' => $imgQuery[
'fields'][
'img_user_text'],
112 'img_media_type' => [
126 'join_conds' => $imgQuery[
'joins'],
152 'type' =>
'combobox',
155 'label-message' =>
'mimetype',
161 HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() )
162 ->setSubmitTextMsg(
'ilsubmit' )
166 ->displayForm(
false );
171 $queryBuilder = $this->
getDatabaseProvider()->getReplicaDatabase()->newSelectQueryBuilder();
175 ->select( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] )
177 ->groupBy( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] );
178 $result = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
182 foreach ( $result as $row ) {
183 $major = $row->img_major_mime;
184 $minor = $row->img_minor_mime;
185 $suggestions[
"$major/$minor" ] =
"$major/$minor";
186 if ( $lastMajor ===
$major ) {
188 $suggestions[
"$major/*" ] =
"$major/*";
192 ksort( $suggestions );
198 $this->mime = $par ?: $this->
getRequest()->getText(
'mime' );
199 $this->mime = trim( $this->mime );
203 if ( $this->major ==
'' || $this->minor ==
'' || $this->minor ==
'unknown' ||
204 !$mimeAnalyzer->isValidMajorMimeType( $this->major )
212 parent::execute( $par );
222 $nt = Title::makeTitle( $result->namespace, $result->title );
224 $text = $this->languageConverter->convertHtml( $nt->getText() );
225 $plink = $linkRenderer->makeLink(
226 Title::newFromText( $nt->getPrefixedText() ),
230 $download = Linker::makeMediaLinkObj( $nt, $this->
msg(
'download' )->escaped() );
231 $download = $this->
msg(
'parentheses' )->rawParams( $download )->escaped();
233 $bytes = htmlspecialchars( $lang->formatSize( $result->img_size ) );
234 $dimensions = $this->
msg(
'widthheight' )->numParams( $result->img_width,
235 $result->img_height )->escaped();
236 $user = $linkRenderer->makeLink(
237 Title::makeTitle(
NS_USER, $result->img_user_text ),
238 $result->img_user_text
241 $time = $lang->userTimeAndDate( $result->img_timestamp, $this->getUser() );
242 $time = htmlspecialchars( $time );
244 return "$download $plink . . $dimensions . . $bytes . . $user . . $time";
260class_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