39 private $groupPermissionsLookup;
42 private $loadBalancer;
45 private $linkBatchFactory;
54 MimeAnalyzer $mimeAnalyzer,
59 parent::__construct(
'Newimages' );
60 $this->groupPermissionsLookup = $groupPermissionsLookup;
61 $this->loadBalancer = $loadBalancer;
62 $this->mediaTypes = $mimeAnalyzer->getMediaTypes();
63 $this->linkBatchFactory = $linkBatchFactory;
79 $opts->
add(
'hidepatrolled',
false );
80 $opts->
add(
'mediatype', $this->mediaTypes );
88 if ( $par !==
null ) {
96 if ( $start !==
'' && $end !==
'' && $start > $end ) {
106 $request = $context->getRequest();
109 [
'start' => $start,
'end' => $end ] + $request->getValues(),
110 $request->wasPosted()
121 if ( !array_diff( $this->mediaTypes,
$mediaTypes ) ) {
137 $this->groupPermissionsLookup,
138 $this->linkBatchFactory,
144 $out->addHTML( $pager->getBody() );
146 $out->addHTML( $pager->getNavigationBar() );
151 $mediaTypesText = array_map(
function (
$type ) {
158 return $this->
msg(
'mediastatistics-header-' . strtolower(
$type ) )->escaped();
160 $mediaTypesOptions = array_combine( $mediaTypesText, $this->mediaTypes );
161 ksort( $mediaTypesOptions );
165 'class' => HTMLUserTextField::class,
166 'label-message' =>
'newimages-user',
172 'label-message' =>
'newimages-showbots',
173 'name' =>
'showbots',
178 'label-message' =>
'newimages-hidepatrolled',
179 'name' =>
'hidepatrolled',
183 'type' =>
'multiselect',
185 'name' =>
'mediatype',
186 'label-message' =>
'newimages-mediatype',
187 'options' => $mediaTypesOptions,
193 'default' => $this->opts->getValue(
'limit' ),
199 'default' => $this->opts->getValue(
'offset' ),
205 'label-message' =>
'date-range-from',
211 'label-message' =>
'date-range-to',
216 if ( !$this->
getUser()->useFilePatrol() ) {
217 unset( $formDescriptor[
'hidepatrolled'] );
220 HTMLForm::factory(
'ooui', $formDescriptor, $context )
222 ->setFormIdentifier(
'specialnewimages' )
223 ->setWrapperLegendMsg(
'newimages-legend' )
224 ->setSubmitTextMsg(
'ilsubmit' )
227 ->displayForm(
false );
238 $message = $this->
msg(
'newimagestext' )->inContentLanguage();
239 if ( !$message->isDisabled() ) {
241 $this->
getOutput()->addWikiTextAsContent(
242 Html::rawElement(
'div',
244 'lang' => $contLang->getHtmlCode(),
245 'dir' => $contLang->getDir()
247 "\n" . $message->plain() .
"\n"
An IContextSource implementation which will inherit context from another source but allow individual ...
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.