'Special-case optimization' seems to be already included in User::getId, in a smarter way; it shouldn't be done in User::isLoggedIn too.

This commit is contained in:
Rotem Liss 2007-12-27 17:04:17 +00:00
parent d00da352d0
commit 405c1c356c
2 changed files with 1 additions and 6 deletions

View file

@ -208,7 +208,7 @@ class UserrightsForm extends HTMLForm {
$user = UserRightsProxy::newFromName( $database, $name );
}
if( !$user || $user->getId() == 0 ) {
if( !$user || $user->isAnon() ) {
$wgOut->addWikiText( wfMsg( 'nosuchusershort', wfEscapeWikiText( $username ) ) );
return null;
}

View file

@ -1729,13 +1729,8 @@ class User {
* Returns true if the user is not an anonymous visitor.
*
* @return bool
* @fixme "special-case optimization" may fail for an object referring to a user that doesn't exist in the system.
*/
function isLoggedIn() {
if( $this->mId === null and $this->mName !== null ) {
// Special-case optimization
return !self::isIP( $this->mName );
}
return $this->getID() != 0;
}