Mroszka has uploaded a new change for review. https://gerrit.wikimedia.org/r/232683
Change subject: Use User::equals() where applicable in the class ...................................................................... Use User::equals() where applicable in the class It is a minor cleanup operation. I replaced a comparison of user 'mId' with a corresponding 'User::equals()' call. The convention of having 'equals()' methods in numerous classes makes perfect sense. In the case of Wikia's MediaWiki-based application I found it more suitable to have 'User::isCurrent()' method. It is a synonym of 'User::equals( $wgUser )'. The name is intuitive and self-explanatory. The usage is simple as there is no need to repeat 'global $wgUser'. See: https://github.com/Wikia/app/pull/8148 It might be a good idea to introduce 'mIsCurrent' property to the 'User' class, defaulting to boolean 'false' and having it set to boolean 'true' while declaring '$wgUser'. It might help to eliminate even more 'global $wgUser', across the entire codebase including the one in 'User::isCurrent()'. Change-Id: I89dea55789f343e794429c38934c263168ef608d --- M includes/User.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/83/232683/1 diff --git a/includes/User.php b/includes/User.php index 9b958f4..fddceab 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1591,7 +1591,7 @@ # We only need to worry about passing the IP address to the Block generator if the # user is not immune to autoblocks/hardblocks, and they are the current user so we # know which IP address they're actually coming from - if ( !$this->isAllowed( 'ipblock-exempt' ) && $this->getID() == $wgUser->getID() ) { + if ( !$this->isAllowed( 'ipblock-exempt' ) && $this->equals( $wgUser ) ) { $ip = $this->getRequest()->getIP(); } else { $ip = null; -- To view, visit https://gerrit.wikimedia.org/r/232683 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I89dea55789f343e794429c38934c263168ef608d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mroszka <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
