| Index: trunk/phase3/includes/specials/SpecialContributions.php |
| — | — | @@ -100,6 +100,8 @@ |
| 101 | 101 | $this->opts['namespace'] = ''; |
| 102 | 102 | } |
| 103 | 103 | |
| | 104 | + $this->opts['nsInvert'] = (bool) $request->getVal( 'nsInvert' ); |
| | 105 | + |
| 104 | 106 | $this->opts['tagfilter'] = (string) $request->getVal( 'tagfilter' ); |
| 105 | 107 | |
| 106 | 108 | // Allows reverts to have the bot flag in recent changes. It is just here to |
| — | — | @@ -167,6 +169,7 @@ |
| 168 | 170 | 'month' => $this->opts['month'], |
| 169 | 171 | 'deletedOnly' => $this->opts['deletedOnly'], |
| 170 | 172 | 'topOnly' => $this->opts['topOnly'], |
| | 173 | + 'nsInvert' => $this->opts['nsInvert'], |
| 171 | 174 | ) ); |
| 172 | 175 | if( !$pager->getNumRows() ) { |
| 173 | 176 | $out->addWikiMsg( 'nocontribs', $target ); |
| — | — | @@ -354,6 +357,10 @@ |
| 355 | 358 | $this->opts['namespace'] = ''; |
| 356 | 359 | } |
| 357 | 360 | |
| | 361 | + if( !isset( $this->opts['nsInvert'] ) ) { |
| | 362 | + $this->opts['nsInvert'] = ''; |
| | 363 | + } |
| | 364 | + |
| 358 | 365 | if( !isset( $this->opts['contribs'] ) ) { |
| 359 | 366 | $this->opts['contribs'] = 'user'; |
| 360 | 367 | } |
| — | — | @@ -381,7 +388,7 @@ |
| 382 | 389 | $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'class' => 'mw-contributions-form' ) ); |
| 383 | 390 | |
| 384 | 391 | # 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' ); |
| 386 | 393 | foreach ( $this->opts as $name => $value ) { |
| 387 | 394 | if( in_array( $name, $skipParameters ) ) { |
| 388 | 395 | continue; |
| — | — | @@ -404,6 +411,7 @@ |
| 405 | 412 | Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' . |
| 406 | 413 | Xml::namespaceSelector( $this->opts['namespace'], '' ) |
| 407 | 414 | ) . |
| | 415 | + Xml::checkLabel( wfMsg('invert'), 'nsInvert', 'nsInvert', $this->opts['nsInvert'] ) . ' ' . |
| 408 | 416 | Xml::checkLabel( wfMsg( 'history-show-deleted' ), |
| 409 | 417 | 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' . |
| 410 | 418 | Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ), |
| — | — | @@ -446,6 +454,7 @@ |
| 447 | 455 | $this->contribs = isset( $options['contribs'] ) ? $options['contribs'] : 'users'; |
| 448 | 456 | $this->namespace = isset( $options['namespace'] ) ? $options['namespace'] : ''; |
| 449 | 457 | $this->tagFilter = isset( $options['tagfilter'] ) ? $options['tagfilter'] : false; |
| | 458 | + $this->nsInvert = isset( $options['nsInvert'] ) ? $options['nsInvert'] : false; |
| 450 | 459 | |
| 451 | 460 | $this->deletedOnly = !empty( $options['deletedOnly'] ); |
| 452 | 461 | $this->topOnly = !empty( $options['topOnly'] ); |
| — | — | @@ -468,6 +477,7 @@ |
| 469 | 478 | |
| 470 | 479 | $user = $this->getUser(); |
| 471 | 480 | $conds = array_merge( $userCond, $this->getNamespaceCond() ); |
| | 481 | + |
| 472 | 482 | // Paranoia: avoid brute force searches (bug 17342) |
| 473 | 483 | if( !$user->isAllowed( 'deletedhistory' ) ) { |
| 474 | 484 | $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0'; |
| — | — | @@ -539,7 +549,11 @@ |
| 540 | 550 | |
| 541 | 551 | function getNamespaceCond() { |
| 542 | 552 | 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 | + } |
| 544 | 558 | } else { |
| 545 | 559 | return array(); |
| 546 | 560 | } |