65 parent::__construct(
'MIMEsearch' );
84 return [
'mime' =>
"{$this->major}/{$this->minor}" ];
89 if ( $this->minor !==
'*' ) {
93 $imgQuery = LocalFile::getQueryInfo();
95 'tables' => $imgQuery[
'tables'],
98 'title' =>
'img_name',
101 'value' =>
'img_name',
105 'img_user_text' => $imgQuery[
'fields'][
'img_user_text'],
113 'img_media_type' => [
127 'join_conds' => $imgQuery[
'joins'],
153 'type' =>
'combobox',
156 'label-message' =>
'mimetype',
162 HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() )
163 ->setSubmitTextMsg(
'ilsubmit' )
167 ->displayForm(
false );
172 $queryBuilder = $this->
getDatabaseProvider()->getReplicaDatabase()->newSelectQueryBuilder();
176 ->select( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] )
178 ->groupBy( [
'img_media_type',
'img_major_mime',
'img_minor_mime' ] );
179 $result = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
183 foreach ( $result as $row ) {
184 $major = $row->img_major_mime;
185 $minor = $row->img_minor_mime;
186 $suggestions[
"$major/$minor" ] =
"$major/$minor";
187 if ( $lastMajor ===
$major ) {
189 $suggestions[
"$major/*" ] =
"$major/*";
193 ksort( $suggestions );
199 $this->mime = $par ?: $this->
getRequest()->getText(
'mime' );
200 $this->mime = trim( $this->mime );
204 if ( $this->major ==
'' || $this->minor ==
'' || $this->minor ==
'unknown' ||
205 !$mimeAnalyzer->isValidMajorMimeType( $this->major )
213 parent::execute( $par );
223 $nt = Title::makeTitle( $result->namespace, $result->title );
225 $text = $this->languageConverter->convertHtml( $nt->getText() );
226 $plink = $linkRenderer->makeLink(
227 Title::newFromText( $nt->getPrefixedText() ),
231 $download = Linker::makeMediaLinkObj( $nt, $this->
msg(
'download' )->escaped() );
232 $download = $this->
msg(
'parentheses' )->rawParams( $download )->escaped();
234 $bytes = htmlspecialchars( $lang->formatSize( $result->img_size ) );
235 $dimensions = $this->
msg(
'widthheight' )->numParams( $result->img_width,
236 $result->img_height )->escaped();
237 $user = $linkRenderer->makeLink(
238 Title::makeTitle(
NS_USER, $result->img_user_text ),
239 $result->img_user_text
242 $time = $lang->userTimeAndDate( $result->img_timestamp, $this->getUser() );
243 $time = htmlspecialchars( $time );
245 return "$download $plink . . $dimensions . . $bytes . . $user . . $time";
261class_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 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