Page MenuHomePhabricator

GenderCache does not cached gender for non-existing users
Closed, ResolvedPublic

Description

The GenderCache (added in r82029) does not store the default value for non-existing users.

Set contentlanguage = de and put the link "[[User:Non-existing]]" in a edit box and show the preview.

That results in the following sql queries (and many more)

SELECT user_name,up_value FROM user LEFT JOIN user_properties ON ((user_id = up_user) AND up_property = 'gender') WHERE user_name = 'Non-existing' (MediaWiki::run/MediaWiki::main/MediaWiki::performRequest/MediaWiki::performAction/EditPage::submit/EditPage::edit/EditPage::showEditForm/EditPage::getPreviewText/StubObject::parse/StubObject::__call/StubObject::_call/call_user_func_array/Parser::parse/Parser::internalParse/Parser::replaceInternalLinks/Parser::replaceInternalLinks2/Title::getPrefixedText/Title::prefix/Title::getNsText/GenderCache::getGenderOf/GenderCache::doQuery)

SELECT user_name,up_value FROM user LEFT JOIN user_properties ON ((user_id = up_user) AND up_property = 'gender') WHERE user_name = 'Non-existing' (MediaWiki::run/MediaWiki::main/MediaWiki::performRequest/MediaWiki::performAction/EditPage::submit/EditPage::edit/EditPage::showEditForm/EditPage::getPreviewText/StubObject::parse/StubObject::__call/StubObject::_call/call_user_func_array/Parser::parse/Parser::internalParse/Parser::replaceInternalLinks/Parser::replaceInternalLinks2/LinkHolderArray::makeHolder/Title::getPrefixedDBkey/Title::prefix/Title::getNsText/GenderCache::getGenderOf/GenderCache::doQuery)

SELECT page_id,page_namespace,page_title,page_is_redirect,page_len,page_latest FROM page WHERE (page_namespace = '2' AND page_title = 'Non-existing') (MediaWiki::run/MediaWiki::main/MediaWiki::performRequest/MediaWiki::performAction/EditPage::submit/EditPage::edit/EditPage::showEditForm/EditPage::getPreviewText/StubObject::parse/StubObject::__call/StubObject::_call/call_user_func_array/Parser::parse/Parser::replaceLinkHolders/LinkHolderArray::replace/LinkHolderArray::replaceInternal)

SELECT user_name,up_value FROM user LEFT JOIN user_properties ON ((user_id = up_user) AND up_property = 'gender') WHERE user_name = 'Non-existing' (MediaWiki::run/MediaWiki::main/MediaWiki::performRequest/MediaWiki::performAction/EditPage::submit/EditPage::edit/EditPage::showEditForm/EditPage::getPreviewText/StubObject::parse/StubObject::__call/StubObject::_call/call_user_func_array/Parser::parse/Parser::replaceLinkHolders/LinkHolderArray::replace/LinkHolderArray::replaceInternal/LinkCache::addBadLinkObj/Title::getPrefixedDBkey/Title::prefix/Title::getNsText/GenderCache::getGenderOf/GenderCache::doQuery)

SELECT user_name,up_value FROM user LEFT JOIN user_properties ON ((user_id = up_user) AND up_property = 'gender') WHERE user_name = 'Non-existing' (MediaWiki::run/MediaWiki::main/MediaWiki::performRequest/MediaWiki::performAction/EditPage::submit/EditPage::edit/EditPage::showEditForm/EditPage::getPreviewText/StubObject::parse/StubObject::__call/StubObject::_call/call_user_func_array/Parser::parse/Parser::replaceLinkHolders/LinkHolderArray::replace/LinkHolderArray::replaceInternal/Linker::link/Linker::linkUrl/Title::getLinkUrl/Title::getLocalURL/Title::getPrefixedDBkey/Title::prefix/Title::getNsText/GenderCache::getGenderOf/GenderCache::doQuery)

One call for the LinkBatch (ok), but 4 calls inside the GenderCache, that is not needed in my opinion.

Having the link [[User:Admin]] (a existing user) in the preview gives:

SELECT user_name,up_value FROM user LEFT JOIN user_properties ON ((user_id = up_user) AND up_property = 'gender') WHERE user_name = 'Admin' (MediaWiki::run/MediaWiki::main/MediaWiki::performRequest/MediaWiki::performAction/EditPage::submit/EditPage::edit/EditPage::showEditForm/EditPage::getPreviewText/StubObject::parse/StubObject::__call/StubObject::_call/call_user_func_array/Parser::parse/Parser::internalParse/Parser::replaceInternalLinks/Parser::replaceInternalLinks2/Title::getPrefixedText/Title::prefix/Title::getNsText/GenderCache::getGenderOf/GenderCache::doQuery)

SELECT page_id,page_namespace,page_title,page_is_redirect,page_len,page_latest FROM page WHERE (page_namespace = '2' AND page_title = 'Admin') (MediaWiki::run/MediaWiki::main/MediaWiki::performRequest/MediaWiki::performAction/EditPage::submit/EditPage::edit/EditPage::showEditForm/EditPage::getPreviewText/StubObject::parse/StubObject::__call/StubObject::_call/call_user_func_array/Parser::parse/Parser::replaceLinkHolders/LinkHolderArray::replace/LinkHolderArray::replaceInternal)

Which looks ok.


Version: 1.20.x
Severity: normal

Details

Reference
bz30972

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 11:50 PM
bzimport set Reference to bz30972.

r97460 fixes it partially.

I've fixed the low hanging fruit, but fixing the parser itself is something I cannot do at this moment.

Having the GenderCache looks enough. When the other queries makes problem, some one will open a bug for that.