MaxSem has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/373383 )
Change subject: Add more checks for user existence ...................................................................... Add more checks for user existence Bug: T173888 Change-Id: Ibcf2dcb867030c0a71534dc0349fb259d04f1706 --- M includes/DeferredChecksJob.php M includes/LoginNotify.php 2 files changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LoginNotify refs/changes/83/373383/1 diff --git a/includes/DeferredChecksJob.php b/includes/DeferredChecksJob.php index 05096eb..275d8ac 100644 --- a/includes/DeferredChecksJob.php +++ b/includes/DeferredChecksJob.php @@ -31,7 +31,7 @@ $checkType = $this->params['checkType']; $userId = $this->params['userId']; $user = User::newFromId( $userId ); - if ( !$user ) { + if ( !$user || $user->isAnon() ) { throw new Exception( "Can't find user for user id=" . print_r( $userId, true ) ); } if ( !isset( $this->params['subnet'] ) || !is_string( $this->params['subnet'] ) ) { diff --git a/includes/LoginNotify.php b/includes/LoginNotify.php index df8217a..baec0a6 100644 --- a/includes/LoginNotify.php +++ b/includes/LoginNotify.php @@ -17,6 +17,7 @@ use JobSpecification; use MediaWiki\MediaWikiServices; use WebRequest; +use Wikimedia\Assert\Assert; use Wikimedia\Rdbms\Database; use Exception; use IP; @@ -216,6 +217,8 @@ * @return string One of USER_* constants */ private function checkUserAllWikis( User $user, $subnet ) { + Assert::parameter( $user->isLoggedIn(), '$user', 'User must be logged in' ); + if ( !$this->config->get( 'LoginNotifyCheckKnownIPs' ) || !class_exists( 'CheckUser' ) ) { -- To view, visit https://gerrit.wikimedia.org/r/373383 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibcf2dcb867030c0a71534dc0349fb259d04f1706 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/LoginNotify Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits