34 parent::__construct(
'Newimages' );
42 $mimeAnalyzer = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
43 $this->mediaTypes = $mimeAnalyzer->getMediaTypes();
53 $opts->
add(
'hidepatrolled',
false );
54 $opts->
add(
'mediatype', $this->mediaTypes );
62 if ( $par !==
null ) {
63 $opts->
setValue( is_numeric( $par ) ?
'limit' :
'like', $par );
70 if ( $start !==
'' && $end !==
'' && $start > $end ) {
80 $request = $context->getRequest();
83 [
'start' => $start,
'end' => $end ] + $request->getValues(),
91 $missingMediaTypes = array_diff( $this->mediaTypes,
$opts->
getValue(
'mediatype' ) );
92 if ( empty( $missingMediaTypes ) ) {
107 $out->addHTML( $pager->getBody() );
109 $out->addHTML( $pager->getNavigationBar() );
114 $mediaTypesText = array_map(
function (
$type ) {
121 return $this->
msg(
'mediastatistics-header-' . strtolower(
$type ) )->escaped();
123 $mediaTypesOptions = array_combine( $mediaTypesText, $this->mediaTypes );
124 ksort( $mediaTypesOptions );
129 'label-message' =>
'newimages-label',
134 'class' =>
'HTMLUserTextField',
135 'label-message' =>
'newimages-user',
141 'label-message' =>
'newimages-showbots',
142 'name' =>
'showbots',
147 'label-message' =>
'newimages-hidepatrolled',
148 'name' =>
'hidepatrolled',
152 'type' =>
'multiselect',
154 'name' =>
'mediatype',
155 'label-message' =>
'newimages-mediatype',
156 'options' => $mediaTypesOptions,
162 'default' => $this->opts->getValue(
'limit' ),
168 'default' => $this->opts->getValue(
'offset' ),
174 'label-message' =>
'date-range-from',
180 'label-message' =>
'date-range-to',
185 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
186 unset( $formDescriptor[
'like'] );
189 if ( !$this->
getUser()->useFilePatrol() ) {
190 unset( $formDescriptor[
'hidepatrolled'] );
193 HTMLForm::factory(
'ooui', $formDescriptor, $context )
195 ->setFormIdentifier(
'specialnewimages' )
196 ->setWrapperLegendMsg(
'newimages-legend' )
197 ->setSubmitTextMsg(
'ilsubmit' )
200 ->displayForm(
false );
211 $message = $this->
msg(
'newimagestext' )->inContentLanguage();
212 if ( !$message->isDisabled() ) {
213 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
214 $this->
getOutput()->addWikiTextAsContent(
215 Html::rawElement(
'div',
218 'lang' => $contLang->getHtmlCode(),
219 'dir' => $contLang->getDir()
221 "\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...
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.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
including( $x=null)
Whether the special page is being evaluated via transclusion.
Interface for objects which can provide a MediaWiki context on request.