9use MediaWiki\Cache\LinkBatchFactory;
16use MediaWiki\Pager\NewFilesPager;
20use Wikimedia\Mime\MimeAnalyzer;
37 private LinkBatchFactory $linkBatchFactory;
40 MimeAnalyzer $mimeAnalyzer,
43 LinkBatchFactory $linkBatchFactory
45 parent::__construct(
'Newimages' );
46 $this->groupPermissionsLookup = $groupPermissionsLookup;
47 $this->dbProvider = $dbProvider;
48 $this->mediaTypes = $mimeAnalyzer->getMediaTypes();
49 $this->linkBatchFactory = $linkBatchFactory;
66 $opts->
add(
'hidepatrolled',
false );
67 $opts->
add(
'mediatype', $this->mediaTypes );
75 if ( $par !==
null ) {
83 if ( $start !==
'' && $end !==
'' && $start > $end ) {
93 $request = $context->getRequest();
96 [
'start' => $start,
'end' => $end ] + $request->getValues(),
108 if ( !array_diff( $this->mediaTypes,
$mediaTypes ) ) {
122 $pager =
new NewFilesPager(
124 $this->groupPermissionsLookup,
125 $this->linkBatchFactory,
131 $out->addHTML( $pager->getBody() );
133 $out->addHTML( $pager->getNavigationBar() );
138 $mediaTypesText = array_map(
function ( $type ) {
145 return $this->
msg(
'mediastatistics-header-' . strtolower( $type ) )->escaped();
147 $mediaTypesOptions = array_combine( $mediaTypesText, $this->mediaTypes );
148 ksort( $mediaTypesOptions );
152 'class' => HTMLUserTextField::class,
153 'label-message' =>
'newimages-user',
159 'label-message' =>
'newimages-showbots',
160 'name' =>
'showbots',
165 'label-message' =>
'newimages-hidepatrolled',
166 'name' =>
'hidepatrolled',
170 'type' =>
'multiselect',
172 'name' =>
'mediatype',
173 'label-message' =>
'newimages-mediatype',
174 'options' => $mediaTypesOptions,
180 'default' => $this->opts->getValue(
'limit' ),
186 'default' => $this->opts->getValue(
'offset' ),
192 'label-message' =>
'date-range-from',
198 'label-message' =>
'date-range-to',
203 if ( !$this->
getUser()->useFilePatrol() ) {
204 unset( $formDescriptor[
'hidepatrolled'] );
207 HTMLForm::factory(
'ooui', $formDescriptor, $context )
209 ->setFormIdentifier(
'specialnewimages' )
210 ->setWrapperLegendMsg(
'newimages-legend' )
211 ->setSubmitTextMsg(
'ilsubmit' )
214 ->displayForm(
false );
226 $message = $this->
msg(
'newimagestext' )->inContentLanguage();
227 if ( !$message->isDisabled() ) {
229 $this->
getOutput()->addWikiTextAsContent(
230 Html::rawElement(
'div',
232 'lang' => $contLang->getHtmlCode(),
233 'dir' => $contLang->getDir()
235 "\n" . $message->plain() .
"\n"
246class_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.