jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/352542 )

Change subject: Change delimiter for multiple namespaces and tags
......................................................................


Change delimiter for multiple namespaces and tags

It's ; for namespaces (since that is generally what we're using,
e.g. for STRING_OPTIONS), and | for tags.  I would have
preferred them to all be consistent, but there is one revision
that has a ;, and this seems better than modifying the DB.

Comma is already used as a delimiter between separate parameters
(e.g. hideanons and namepsace).

Also, fix multiple namespaces for parseParameters and add test
cases.

Bug: T164132
Bug: T164133
Change-Id: Iad061e0bc17e3522a3f5d330ac2c8bf9cf0e614f
---
M includes/changetags/ChangeTags.php
M includes/specialpage/ChangesListSpecialPage.php
M includes/specials/SpecialRecentchanges.php
M tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
M tests/phpunit/includes/specials/SpecialRecentchangesTest.php
5 files changed, 18 insertions(+), 11 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  Sbisson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/changetags/ChangeTags.php 
b/includes/changetags/ChangeTags.php
index 46cae8f..a07d3c9 100644
--- a/includes/changetags/ChangeTags.php
+++ b/includes/changetags/ChangeTags.php
@@ -660,7 +660,7 @@
 
                        $tables[] = 'change_tag';
                        $join_conds['change_tag'] = [ 'INNER JOIN', $join_cond 
];
-                       $conds['ct_tag'] = explode( ',', $filter_tag );
+                       $conds['ct_tag'] = explode( '|', $filter_tag );
                }
        }
 
@@ -947,9 +947,12 @@
                        return Status::newFatal( 'tags-create-no-name' );
                }
 
-               // tags cannot contain commas (used as a delimiter in 
tag_summary table) or
-               // slashes (would break tag description messages in MediaWiki 
namespace)
-               if ( strpos( $tag, ',' ) !== false || strpos( $tag, '/' ) !== 
false ) {
+               // tags cannot contain commas (used as a delimiter in 
tag_summary table),
+               // pipe (used as a delimiter between multiple tags in
+               // modifyDisplayQuery), or slashes (would break tag description 
messages in
+               // MediaWiki namespace)
+               if ( strpos( $tag, ',' ) !== false || strpos( $tag, '|' ) !== 
false
+                       || strpos( $tag, '/' ) !== false ) {
                        return Status::newFatal( 'tags-create-invalid-chars' );
                }
 
diff --git a/includes/specialpage/ChangesListSpecialPage.php 
b/includes/specialpage/ChangesListSpecialPage.php
index 7e70df2..51212ba 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -1078,7 +1078,7 @@
 
                // Namespace filtering
                if ( $opts[ 'namespace' ] !== '' ) {
-                       $namespaces = explode( ',', $opts[ 'namespace' ] );
+                       $namespaces = explode( ';', $opts[ 'namespace' ] );
 
                        if ( $opts[ 'associated' ] ) {
                                $associatedNamespaces = array_map(
diff --git a/includes/specials/SpecialRecentchanges.php 
b/includes/specials/SpecialRecentchanges.php
index c10dbdd..f09dae7 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -291,7 +291,7 @@
                        if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
                                $opts['days'] = $m[1];
                        }
-                       if ( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
+                       if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) {
                                $opts['namespace'] = $m[1];
                        }
                        if ( preg_match( '/^tagfilter=(.*)$/', $bit, $m ) ) {
diff --git a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php 
b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
index c8c65dc..e2209eb 100644
--- a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
+++ b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
@@ -136,7 +136,7 @@
                                "rc_namespace IN ('1','2','3')",
                        ],
                        [
-                               'namespace' => '1,2,3',
+                               'namespace' => '1;2;3',
                        ],
                        "rc conditions with multiple namespaces"
                );
@@ -148,7 +148,7 @@
                                "rc_namespace IN ('0','1','4','5','6','7')",
                        ],
                        [
-                               'namespace' => '1,4,7',
+                               'namespace' => '1;4;7',
                                'associated' => 1,
                        ],
                        "rc conditions with multiple namespaces and associated"
@@ -161,7 +161,7 @@
                                "rc_namespace NOT IN ('2','3','8','9')",
                        ],
                        [
-                               'namespace' => '2,3,9',
+                               'namespace' => '2;3;9',
                                'associated' => 1,
                                'invert' => 1
                        ],
@@ -175,7 +175,7 @@
                                "rc_namespace NOT IN ('1','2','3')",
                        ],
                        [
-                               'namespace' => '1,2,3',
+                               'namespace' => '1;2;3',
                                'invert' => 1,
                        ],
                        "rc conditions with multiple namespaces inverted"
diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php 
b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
index 8f3f585..85becff 100644
--- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
+++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
@@ -27,9 +27,13 @@
 
                        [ 'days=3', [ 'days' => '3' ] ],
 
-                       [ 'namespace=5', [ 'namespace' => 5 ] ],
+                       [ 'namespace=5', [ 'namespace' => '5' ] ],
+
+                       [ 'namespace=5|3', [ 'namespace' => '5|3' ] ],
 
                        [ 'tagfilter=foo', [ 'tagfilter' => 'foo' ] ],
+
+                       [ 'tagfilter=foo;bar', [ 'tagfilter' => 'foo;bar' ] ],
                ];
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iad061e0bc17e3522a3f5d330ac2c8bf9cf0e614f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Catrope <r...@wikimedia.org>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Sbisson <sbis...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to