* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* This class checks if user can get extra rights
* because of conditions specified in $wgAutopromote
}
return $user->getEditCount() >= $reqEditCount;
case APCOND_AGE:
- $age = time() - wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
+ $age = time() - (int)wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
return $age >= $cond[1];
case APCOND_AGE_FROM_EDIT:
- $age = time() - wfTimestampOrNull( TS_UNIX, $user->getFirstEditTimestamp() );
+ $age = time() - (int)wfTimestampOrNull( TS_UNIX, $user->getFirstEditTimestamp() );
return $age >= $cond[1];
case APCOND_INGROUPS:
$groups = array_slice( $cond, 1 );
case APCOND_IPINRANGE:
return IP::isInRange( $user->getRequest()->getIP(), $cond[1] );
case APCOND_BLOCKED:
- // @TODO Should partial blocks prevent auto promote?
- return (bool)$user->getBlock();
+ return $user->getBlock() && $user->getBlock()->isSitewide();
case APCOND_ISBOT:
- return in_array( 'bot', User::getGroupPermissions( $user->getGroups() ) );
+ return in_array( 'bot', MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->getGroupPermissions( $user->getGroups() ) );
default:
$result = null;
Hooks::run( 'AutopromoteCondition', [ $cond[0],