Currently the series of functions related to Linker::userToolLinks (userLink, userToolLinks, userToolLinksRedContribs, userTalkLink, blockLink) accept two arguments: a user ID and a user name. This is ridiculous, because not a single one of them actually needs the user ID, and getting it typically requires an extra database query. This makes it unnecessarily difficult to use them in new places like on log pages (bug 10655). They should be changed to accept a User object, and the User object should be made more efficient so isAnon() doesn't require a database query if a username is provided.
A couple of notes on the patch:
- I've just converted the calling convention for the existing functions completely. This may be confusing; personally I prefer it to an Obj syntax like we have for makeLink and friends, but that could be used instead if desired, and the existing versions deprecated.
- The User changes require that User::isIP be accurate. I assume it is, because no users are allowed to register if it returns true, so there should be no rows in the database if it's true, so the current way of checking the database to see if the user is an IP is pointless for User::isLoggedIn.
- I declared a bunch of @private functions public, because some of them are in practice, and the rest are useful to other classes, so there's no reason for them to be private.
I've tested the patch reasonably, browsing around histories and RC and so forth, making sure I got a mix of anons, registereds, people with/without talk pages, etc.
attachment 10663.diff ignored as obsolete