r103708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103707‎ | r103708 | r103709 >
Date:21:03, 19 November 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
* (bug 19698) Inverse selection for Special:Contributions

Manually updated patch to fix conflicts
Modified paths:
  • /trunk/phase3/includes/specials/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -100,6 +100,8 @@
101101 $this->opts['namespace'] = '';
102102 }
103103
 104+ $this->opts['nsInvert'] = (bool) $request->getVal( 'nsInvert' );
 105+
104106 $this->opts['tagfilter'] = (string) $request->getVal( 'tagfilter' );
105107
106108 // Allows reverts to have the bot flag in recent changes. It is just here to
@@ -167,6 +169,7 @@
168170 'month' => $this->opts['month'],
169171 'deletedOnly' => $this->opts['deletedOnly'],
170172 'topOnly' => $this->opts['topOnly'],
 173+ 'nsInvert' => $this->opts['nsInvert'],
171174 ) );
172175 if( !$pager->getNumRows() ) {
173176 $out->addWikiMsg( 'nocontribs', $target );
@@ -354,6 +357,10 @@
355358 $this->opts['namespace'] = '';
356359 }
357360
 361+ if( !isset( $this->opts['nsInvert'] ) ) {
 362+ $this->opts['nsInvert'] = '';
 363+ }
 364+
358365 if( !isset( $this->opts['contribs'] ) ) {
359366 $this->opts['contribs'] = 'user';
360367 }
@@ -381,7 +388,7 @@
382389 $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) );
383390
384391 # Add hidden params for tracking except for parameters in $skipParameters
385 - $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly' );
 392+ $skipParameters = array( 'namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly' );
386393 foreach ( $this->opts as $name => $value ) {
387394 if( in_array( $name, $skipParameters ) ) {
388395 continue;
@@ -404,6 +411,7 @@
405412 Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
406413 Xml::namespaceSelector( $this->opts['namespace'], '' )
407414 ) .
 415+ Xml::checkLabel( wfMsg('invert'), 'nsInvert', 'nsInvert', $this->opts['nsInvert'] ) . ' ' .
408416 Xml::checkLabel( wfMsg( 'history-show-deleted' ),
409417 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' .
410418 Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ),
@@ -446,6 +454,7 @@
447455 $this->contribs = isset( $options['contribs'] ) ? $options['contribs'] : 'users';
448456 $this->namespace = isset( $options['namespace'] ) ? $options['namespace'] : '';
449457 $this->tagFilter = isset( $options['tagfilter'] ) ? $options['tagfilter'] : false;
 458+ $this->nsInvert = isset( $options['nsInvert'] ) ? $options['nsInvert'] : false;
450459
451460 $this->deletedOnly = !empty( $options['deletedOnly'] );
452461 $this->topOnly = !empty( $options['topOnly'] );
@@ -468,6 +477,7 @@
469478
470479 $user = $this->getUser();
471480 $conds = array_merge( $userCond, $this->getNamespaceCond() );
 481+
472482 // Paranoia: avoid brute force searches (bug 17342)
473483 if( !$user->isAllowed( 'deletedhistory' ) ) {
474484 $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0';
@@ -539,7 +549,11 @@
540550
541551 function getNamespaceCond() {
542552 if( $this->namespace !== '' ) {
543 - return array( 'page_namespace' => (int)$this->namespace );
 553+ if ( $this->nsInvert ) {
 554+ return array( 'page_namespace != ' . (int)$this->namespace );
 555+ } else {
 556+ return array( 'page_namespace' => (int)$this->namespace );
 557+ }
544558 } else {
545559 return array();
546560 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r103710RELEASE-NOTES-1.19 for r103706, r103708...reedy21:17, 19 November 2011
r104234&nbsp; -> &#160;...hashar12:22, 25 November 2011

Comments

#Comment by Reedy (talk | contribs)   21:05, 19 November 2011

Patch by Nakon

#Comment by Nikerabbit (talk | contribs)   07:28, 21 November 2011

&nbsp; should be &#160;

#Comment by Hashar (talk | contribs)   12:23, 25 November 2011

updated with r104234

Status & tagging log