SpecialNewimages: Do not add the module when the special page is included
authorFomafix <fomafix@googlemail.com>
Sun, 11 Jun 2017 18:46:41 +0000 (20:46 +0200)
committerFomafix <fomafix@googlemail.com>
Sun, 11 Jun 2017 20:26:14 +0000 (22:26 +0200)
When the special page is included with
{{Special:NewImages}}
the module 'mediawiki.special.newFiles' throws an error.

This change loads the module 'mediawiki.special.newFiles' together with the
form.

Bug: T167601
Change-Id: I5a0589f62388292851664daf1ab5e63008556a64

includes/specials/SpecialNewimages.php

index 583d4f9..5fa0a73 100644 (file)
@@ -34,7 +34,6 @@ class SpecialNewFiles extends IncludableSpecialPage {
                $this->outputHeader();
 
                $out = $this->getOutput();
                $this->outputHeader();
 
                $out = $this->getOutput();
-               $out->addModules( 'mediawiki.special.newFiles' );
                $this->addHelpLink( 'Help:New images' );
 
                $opts = new FormOptions();
                $this->addHelpLink( 'Help:New images' );
 
                $opts = new FormOptions();
@@ -149,6 +148,8 @@ class SpecialNewFiles extends IncludableSpecialPage {
                        ->setMethod( 'get' )
                        ->prepareForm()
                        ->displayForm( false );
                        ->setMethod( 'get' )
                        ->prepareForm()
                        ->displayForm( false );
+
+               $this->getOutput()->addModules( 'mediawiki.special.newFiles' );
        }
 
        protected function getGroupName() {
        }
 
        protected function getGroupName() {