* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A special page that list newly created pages
*
parent::__construct( 'Newpages' );
}
+ /**
+ * @param string|null $par
+ */
protected function setup( $par ) {
- // Options
$opts = new FormOptions();
$this->opts = $opts; // bind
$opts->add( 'hideliu', false );
$opts->add( 'feed', '' );
$opts->add( 'tagfilter', '' );
$opts->add( 'invert', false );
+ $opts->add( 'associated', false );
$opts->add( 'size-mode', 'max' );
$opts->add( 'size', 0 );
$opts->add( $key, $params['default'] );
}
- // Set values
$opts->fetchValuesFromRequest( $this->getRequest() );
if ( $par ) {
$this->parseParams( $par );
}
- // Validate
$opts->validateIntBounds( 'limit', 0, 5000 );
}
+ /**
+ * @param string $par
+ */
protected function parseParams( $par ) {
$bits = preg_split( '/\s*,\s*/', trim( $par ) );
foreach ( $bits as $bit ) {
/**
* Show a form for filtering namespace and username
*
- * @param string $par
+ * @param string|null $par
*/
public function execute( $par ) {
$out = $this->getOutput();
$navigation = $pager->getNavigationBar();
}
$out->addHTML( $navigation . $pager->getBody() . $navigation );
+ // Add styles for change tags
+ $out->addModuleStyles( 'mediawiki.interface.helpers.styles' );
} else {
$out->addWikiMsg( 'specialpage-empty' );
}
}
// Disable some if needed
- if ( !User::groupHasPermission( '*', 'createpage' ) ) {
+ if ( !MediaWikiServices::getInstance()->getPermissionManager()
+ ->groupHasPermission( '*', 'createpage' )
+ ) {
unset( $filters['hideliu'] );
}
if ( !$this->getUser()->useNPPatrol() ) {
// wfArrayToCgi(), called from LinkRenderer/Title, will not output null and false values
// to the URL, which would omit some options (T158504). Fix it by explicitly setting them
// to 0 or 1.
- $changed = array_map( function ( $value ) {
- return $value ? '1' : '0';
- }, $changed );
+ // Also do this only for boolean options, not eg. namespace or tagfilter
+ foreach ( $changed as $key => $value ) {
+ if ( array_key_exists( $key, $filters ) ) {
+ $changed[$key] = $changed[$key] ? '1' : '0';
+ }
+ }
$self = $this->getPageTitle();
$linkRenderer = $this->getLinkRenderer();
$username = $this->opts->consumeValue( 'username' );
$tagFilterVal = $this->opts->consumeValue( 'tagfilter' );
$nsinvert = $this->opts->consumeValue( 'invert' );
+ $nsassociated = $this->opts->consumeValue( 'associated' );
$size = $this->opts->consumeValue( 'size' );
$max = $this->opts->consumeValue( 'size-mode' ) === 'max';
'default' => $nsinvert,
'tooltip' => 'invert',
],
+ 'nsassociated' => [
+ 'type' => 'check',
+ 'name' => 'associated',
+ 'label-message' => 'namespace_association',
+ 'default' => $nsassociated,
+ 'tooltip' => 'namespace_association',
+ ],
'tagFilter' => [
'type' => 'tagfilter',
'name' => 'tagfilter',