Mattflaschen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/352542 )

Change subject: Change delimiter for multiple namespaces and tags to semi-colon
......................................................................

Change delimiter for multiple namespaces and tags to semi-colon

This is required because 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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/42/352542/1

diff --git a/includes/changetags/ChangeTags.php 
b/includes/changetags/ChangeTags.php
index 46cae8f..f054a51 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),
+               // semi-colons (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..7013f22 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: newchange
Gerrit-Change-Id: Iad061e0bc17e3522a3f5d330ac2c8bf9cf0e614f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

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

Reply via email to