36 private $groupPermissionsLookup;
39 private $loadBalancer;
42 private $linkBatchFactory;
51 MimeAnalyzer $mimeAnalyzer,
56 parent::__construct(
'Newimages' );
57 $this->groupPermissionsLookup = $groupPermissionsLookup;
58 $this->loadBalancer = $loadBalancer;
59 $this->mediaTypes = $mimeAnalyzer->getMediaTypes();
60 $this->linkBatchFactory = $linkBatchFactory;
76 $opts->
add(
'hidepatrolled',
false );
77 $opts->
add(
'mediatype', $this->mediaTypes );
85 if ( $par !==
null ) {
93 if ( $start !==
'' && $end !==
'' && $start > $end ) {
103 $request = $context->getRequest();
106 [
'start' => $start,
'end' => $end ] + $request->getValues(),
107 $request->wasPosted()
114 $missingMediaTypes = array_diff( $this->mediaTypes,
$opts->
getValue(
'mediatype' ) );
115 if ( empty( $missingMediaTypes ) ) {
130 $this->groupPermissionsLookup,
131 $this->linkBatchFactory,
137 $out->addHTML( $pager->getBody() );
139 $out->addHTML( $pager->getNavigationBar() );
144 $mediaTypesText = array_map(
function (
$type ) {
151 return $this->
msg(
'mediastatistics-header-' . strtolower(
$type ) )->escaped();
153 $mediaTypesOptions = array_combine( $mediaTypesText, $this->mediaTypes );
154 ksort( $mediaTypesOptions );
158 'class' => HTMLUserTextField::class,
159 'label-message' =>
'newimages-user',
165 'label-message' =>
'newimages-showbots',
166 'name' =>
'showbots',
171 'label-message' =>
'newimages-hidepatrolled',
172 'name' =>
'hidepatrolled',
176 'type' =>
'multiselect',
178 'name' =>
'mediatype',
179 'label-message' =>
'newimages-mediatype',
180 'options' => $mediaTypesOptions,
186 'default' => $this->opts->getValue(
'limit' ),
192 'default' => $this->opts->getValue(
'offset' ),
198 'label-message' =>
'date-range-from',
204 'label-message' =>
'date-range-to',
209 if ( !$this->
getUser()->useFilePatrol() ) {
210 unset( $formDescriptor[
'hidepatrolled'] );
213 HTMLForm::factory(
'ooui', $formDescriptor, $context )
215 ->setFormIdentifier(
'specialnewimages' )
216 ->setWrapperLegendMsg(
'newimages-legend' )
217 ->setSubmitTextMsg(
'ilsubmit' )
220 ->displayForm(
false );
231 $message = $this->
msg(
'newimagestext' )->inContentLanguage();
232 if ( !$message->isDisabled() ) {
234 $this->
getOutput()->addWikiTextAsContent(
235 Html::rawElement(
'div',
237 'lang' => $contLang->getHtmlCode(),
238 'dir' => $contLang->getDir()
240 "\n" . $message->plain() .
"\n"
An IContextSource implementation which will inherit context from another source but allow individual ...
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
Shortcut to construct an includable special page.
buildForm(IContextSource $context)
execute( $par)
Default execute method Checks user permissions.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
__construct(MimeAnalyzer $mimeAnalyzer, GroupPermissionsLookup $groupPermissionsLookup, ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory)
setTopText()
Send the text to be displayed above the options.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getContentLanguage()
Shortcut to get content language.
including( $x=null)
Whether the special page is being evaluated via transclusion.
Interface for objects which can provide a MediaWiki context on request.