Add more checks for user existence

Bug: T173888
Change-Id: Ibcf2dcb867030c0a71534dc0349fb259d04f1706
This commit is contained in:
Max Semenik 2017-08-23 14:32:59 -07:00
parent c5d5020e6b
commit fc6f25c514
2 changed files with 4 additions and 1 deletions

View file

@ -31,7 +31,7 @@ class DeferredChecksJob extends Job {
$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'] ) ) {

View file

@ -17,6 +17,7 @@ use JobQueueGroup;
use JobSpecification;
use MediaWiki\MediaWikiServices;
use WebRequest;
use Wikimedia\Assert\Assert;
use Wikimedia\Rdbms\Database;
use Exception;
use IP;
@ -216,6 +217,8 @@ class LoginNotify implements LoggerAwareInterface {
* @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' )
) {