aboutsummaryrefslogtreecommitdiffstats
path: root/includes/user/User.php
diff options
context:
space:
mode:
authorTim Starling <tstarling@wikimedia.org>2023-10-18 11:22:21 +1100
committerDaniel Kinzler <dkinzler@wikimedia.org>2023-10-27 17:42:29 +0000
commitdfc691bfc5289d6263d55bb719ffa11ed9d0f80a (patch)
treeafe81285bfb56545ea6ea4c22fa75648ce805b11 /includes/user/User.php
parentc736486615b44ae914254e8a0af397f9e9250cf2 (diff)
downloadmediawikicore-dfc691bfc5289d6263d55bb719ffa11ed9d0f80a.tar.gz
mediawikicore-dfc691bfc5289d6263d55bb719ffa11ed9d0f80a.zip
Migrate callers of deprecated method BlockManager::getUserBlock()
Bug: T345683 Depends-On: I2fff3ff961f788ca2fa84eba54293edf9145d738 Change-Id: I6d00af72cdda2a949b861dba402cf2f0c70d1b49
Diffstat (limited to 'includes/user/User.php')
-rw-r--r--includes/user/User.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/includes/user/User.php b/includes/user/User.php
index 497b39b7b528..f977a39fd44f 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -1431,6 +1431,12 @@ class User implements Authority, UserIdentity, UserEmailContact {
$fromReplica = ( $freshness !== self::READ_LATEST );
}
+ if ( $disableIpBlockExemptChecking ) {
+ $isExempt = false;
+ } else {
+ $isExempt = $this->isAllowed( 'ipblock-exempt' );
+ }
+
// TODO: Block checking shouldn't really be done from the User object. Block
// checking can involve checking for IP blocks, cookie blocks, and/or XFF blocks,
// which need more knowledge of the request context than the User should have.
@@ -1439,16 +1445,15 @@ class User implements Authority, UserIdentity, UserEmailContact {
// - Check if this is the user associated with the main request
// - If so, pass the relevant request information to the block manager
$request = null;
- if ( $this->isGlobalSessionUser() ) {
+ if ( !$isExempt && $this->isGlobalSessionUser() ) {
// This is the global user, so we need to pass the request
$request = $this->getRequest();
}
- return MediaWikiServices::getInstance()->getBlockManager()->getUserBlock(
+ return MediaWikiServices::getInstance()->getBlockManager()->getBlock(
$this,
$request,
$fromReplica,
- $disableIpBlockExemptChecking
);
}