34use Wikimedia\Mime\MimeAnalyzer;
60 MimeAnalyzer $mimeAnalyzer,
65 parent::__construct(
'Newimages' );
66 $this->groupPermissionsLookup = $groupPermissionsLookup;
67 $this->dbProvider = $dbProvider;
68 $this->mediaTypes = $mimeAnalyzer->getMediaTypes();
69 $this->linkBatchFactory = $linkBatchFactory;
85 $opts->
add(
'hidepatrolled',
false );
86 $opts->
add(
'mediatype', $this->mediaTypes );
94 if ( $par !==
null ) {
102 if ( $start !==
'' && $end !==
'' && $start > $end ) {
112 $request = $context->getRequest();
115 [
'start' => $start,
'end' => $end ] + $request->getValues(),
116 $request->wasPosted()
127 if ( !array_diff( $this->mediaTypes,
$mediaTypes ) ) {
143 $this->groupPermissionsLookup,
144 $this->linkBatchFactory,
150 $out->addHTML( $pager->getBody() );
152 $out->addHTML( $pager->getNavigationBar() );
157 $mediaTypesText = array_map(
function ( $type ) {
164 return $this->
msg(
'mediastatistics-header-' . strtolower( $type ) )->escaped();
166 $mediaTypesOptions = array_combine( $mediaTypesText, $this->mediaTypes );
167 ksort( $mediaTypesOptions );
171 'class' => HTMLUserTextField::class,
172 'label-message' =>
'newimages-user',
178 'label-message' =>
'newimages-showbots',
179 'name' =>
'showbots',
184 'label-message' =>
'newimages-hidepatrolled',
185 'name' =>
'hidepatrolled',
189 'type' =>
'multiselect',
191 'name' =>
'mediatype',
192 'label-message' =>
'newimages-mediatype',
193 'options' => $mediaTypesOptions,
199 'default' => $this->opts->getValue(
'limit' ),
205 'default' => $this->opts->getValue(
'offset' ),
211 'label-message' =>
'date-range-from',
217 'label-message' =>
'date-range-to',
222 if ( !$this->
getUser()->useFilePatrol() ) {
223 unset( $formDescriptor[
'hidepatrolled'] );
226 HTMLForm::factory(
'ooui', $formDescriptor, $context )
228 ->setFormIdentifier(
'specialnewimages' )
229 ->setWrapperLegendMsg(
'newimages-legend' )
230 ->setSubmitTextMsg(
'ilsubmit' )
233 ->displayForm(
false );
244 $message = $this->
msg(
'newimagestext' )->inContentLanguage();
245 if ( !$message->isDisabled() ) {
247 $this->
getOutput()->addWikiTextAsContent(
248 Html::rawElement(
'div',
250 'lang' => $contLang->getHtmlCode(),
251 'dir' => $contLang->getDir()
253 "\n" . $message->plain() .
"\n"
264class_alias( SpecialNewFiles::class,
'SpecialNewFiles' );
An IContextSource implementation which will inherit context from another source but allow individual ...
Implements a text input field for user names.
Shortcut to construct an includable special page.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
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.
getOutput()
Get the OutputPage being used for this instance.
getContentLanguage()
Shortcut to get content language.
including( $x=null)
Whether the special page is being evaluated via transclusion.
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.
Interface for objects which can provide a MediaWiki context on request.