jenkins-bot has submitted this change and it was merged.

Change subject: Implement namespace inversion on WhatLinksHere
......................................................................


Implement namespace inversion on WhatLinksHere

This is basically the same as Ie3f72d97e2ba did for SpecialNewPages.

Bug: T18848
Change-Id: Id6cbdaca50c81129352962996dc5360f64026ed1
---
M includes/specials/SpecialWhatlinkshere.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 21 insertions(+), 6 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  Siebrand: Looks good to me, but someone else must approve
  Umherirrender: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialWhatlinkshere.php 
b/includes/specials/SpecialWhatlinkshere.php
index e373cff..07ea933 100644
--- a/includes/specials/SpecialWhatlinkshere.php
+++ b/includes/specials/SpecialWhatlinkshere.php
@@ -58,6 +58,7 @@
                $opts->add( 'hidetrans', false );
                $opts->add( 'hidelinks', false );
                $opts->add( 'hideimages', false );
+               $opts->add( 'invert', false );
 
                $opts->fetchValuesFromRequest( $this->getRequest() );
                $opts->validateIntBounds( 'limit', 0, 5000 );
@@ -125,15 +126,17 @@
 
                $useLinkNamespaceDBFields = $this->getConfig()->get( 
'UseLinkNamespaceDBFields' );
                $namespace = $this->opts->getValue( 'namespace' );
+               $invert = $this->opts->getValue( 'invert' );
+               $nsComparison = ( $invert ? '!= ' : '= ' ) . $dbr->addQuotes( 
$namespace );
                if ( is_int( $namespace ) ) {
                        if ( $useLinkNamespaceDBFields ) {
-                               $conds['pagelinks']['pl_from_namespace'] = 
$namespace;
-                               $conds['templatelinks']['tl_from_namespace'] = 
$namespace;
-                               $conds['imagelinks']['il_from_namespace'] = 
$namespace;
+                               $conds['pagelinks'][] = "pl_from_namespace 
$nsComparison";
+                               $conds['templatelinks'][] = "tl_from_namespace 
$nsComparison";
+                               $conds['imagelinks'][] = "il_from_namespace 
$nsComparison";
                        } else {
-                               $conds['pagelinks']['page_namespace'] = 
$namespace;
-                               $conds['templatelinks']['page_namespace'] = 
$namespace;
-                               $conds['imagelinks']['page_namespace'] = 
$namespace;
+                               $conds['pagelinks'][] = "page_namespace 
$nsComparison";
+                               $conds['templatelinks'][] = "page_namespace 
$nsComparison";
+                               $conds['imagelinks'][] = "page_namespace 
$nsComparison";
                        }
                }
 
@@ -419,6 +422,7 @@
 
                $target = $this->target ? $this->target->getPrefixedText() : '';
                $namespace = $this->opts->consumeValue( 'namespace' );
+               $nsinvert = $this->opts->consumeValue( 'invert' );
 
                # Build up the form
                $f = Xml::openElement( 'form', array( 'action' => wfScript() ) 
);
@@ -450,6 +454,15 @@
                        )
                );
 
+               $f .= ' ' .
+                       Xml::checkLabel(
+                               $this->msg( 'invert' )->text(),
+                               'invert',
+                               'nsinvert',
+                               $nsinvert,
+                               array( 'title' => $this->msg( 
'tooltip-whatlinkshere-invert' )->text() )
+                       );
+
                $f .= ' ';
 
                # Submit
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 45c7105..1c40f75 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1993,6 +1993,7 @@
        "namespace": "Namespace:",
        "invert": "Invert selection",
        "tooltip-invert": "Check this box to hide changes to pages within the 
selected namespace (and the associated namespace if checked)",
+       "tooltip-whatlinkshere-invert": "Check this box to hide links from 
pages within the selected namespace.",
        "namespace_association": "Associated namespace",
        "tooltip-namespace_association": "Check this box to also include the 
talk or subject namespace associated with the selected namespace",
        "blanknamespace": "(Main)",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 9b09078..2b29b5f 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2157,6 +2157,7 @@
        "namespace": "This message is located at 
[[Special:Contributions]].\n{{Identical|Namespace}}",
        "invert": "Displayed in [[Special:RecentChanges|RecentChanges]], 
[[Special:RecentChangesLinked|RecentChangesLinked]] and 
[[Special:Watchlist|Watchlist]].\n\nThis message means \"Invert selection of 
namespace\".\n\nThis message has a tooltip 
{{msg-mw|tooltip-invert}}\n{{Identical|Invert selection}}",
        "tooltip-invert": "Used in [[Special:Recentchanges]] as a tooltip for 
the invert checkbox. See also the message {{msg-mw|invert}}",
+       "tooltip-whatlinkshere-invert": "Used in [[Special:Whatlinkshere]] as a 
tooltip for the invert checkbox.\n\nSee also:\n* {{msg-mw|tooltip-invert}}\n* 
{{msg-mw|invert}}",
        "namespace_association": "Used in [[Special:Recentchanges]] with a 
checkbox which selects the associated namespace to be added to the selected 
namespace, so that both are searched (or excluded depending on another checkbox 
selection). The association is between a namespace and its talk 
namespace.\n\nThis message has a tooltip {{msg-mw|tooltip-namespace 
association}}",
        "tooltip-namespace_association": "Used in [[Special:Recentchanges]] as 
a tooltip for the associated namespace checkbox.\n\nSee also:\n* 
{{msg-mw|Namespace association}}",
        "blanknamespace": "Name for main namespace (blank namespace) in 
drop-down menus at [[Special:RecentChanges]] and other special 
pages.\n{{Identical|Main}}",

-- 
To view, visit https://gerrit.wikimedia.org/r/129933
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id6cbdaca50c81129352962996dc5360f64026ed1
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: PiRSquared17 <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Springle <[email protected]>
Gerrit-Reviewer: TTO <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: devunt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to