Page MenuHomePhabricator

Make GENDER ignore everything after slash
Closed, DeclinedPublic

Description

Author: p.selitskas

Description:
Slashes in user names are not allowed.[1] If the string contains slash(es) and slash is not the first symbol, we can assume that text before the first slash is a user name.

If my assumption is correct or is not false, then I'll send a patch for review. Actually it will be a one-liner.

In CoreParserFunctions::gender(): 
if ( $title && $title->getNamespace() == NS_USER ) {
	$username = $title->getText(); // change to $title->getRootText()
}

[1] https://www.mediawiki.org/wiki/Manual:User_table#user_name

Details

Reference
bz47958

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:29 AM
bzimport set Reference to bz47958.

It is easier to pass the correct string to the function instead of let the server determine it for you. Maybe the new variable ROOTPAGENAME can help you by that (bug 6747).

p.selitskas wrote:

(In reply to comment #1)

It is easier to pass the correct string to the function instead of let the
server determine it for you. Maybe the new variable ROOTPAGENAME can help you
by that (bug 6747).

I don't object the new variable. Moreover, I support this one by all means mostly because we shouldn't rely on magic words provided by extensions (like #titleparts).

But do you agree that there is no sense in supplying deliberately wrong data to the further parts of gender-related code?

Related URL: https://gerrit.wikimedia.org/r/62146 (Gerrit Change I4152b51e935bb1e7a4accf9b888d34b6f58519c2)

Krinkle subscribed.

The GENDER parser function operates on user names. Values that are not user names are not valid input to this function.

It seems the underlying use case was to automatically pass a user name based on the current page title, for example so that a template could render an interface message appropiate for user Foo given a page like User:Foo, User:Foo/sandbox, or User_talk:Foo.

There are various magic words and parser functions available in MediaWiki to accomodate this, per https://www.mediawiki.org/wiki/Help:Magic_words. If there are circumstances where those do not suffice, please file a new task with a description of the use case so that we may improve those instead.