Attempt to lookup UID by UserIdentity

Change-Id: Ib00b791cfeb206b1f8eb697985444c7d1754f849
这个提交包含在:
xtex 2024-04-05 22:28:49 +08:00
父节点 2244f41f1e
当前提交 3143cdeb73
找不到此签名对应的密钥
GPG 密钥 ID: B918086ED8045B91

查看文件

@ -1,13 +1,14 @@
<?php
use MediaWiki\MediaWikiServices;
use MediaWiki\User\UserIdentity;
class GlobalUserrightsHooks {
/**
* Function to get a given user's global groups
*
* @param User|int $user instance of User class or uid
* @param UserIdentity|int $user instance of UserIdentity class or uid
* @return array of global groups
*/
public static function getGroups( $user ) {
@ -17,11 +18,11 @@ class GlobalUserrightsHooks {
/**
* Function to get a given user's global groups memberships
*
* @param int|User $user instance of User class or uid
* @param int|UserIdentity $user instance of UserIdentity class or uid
* @return array
*/
public static function getGroupMemberships( $user ) {
if ( $user instanceof User ) {
if ( $user instanceof UserIdentity ) {
if ( method_exists( MediaWikiServices::class, 'getCentralIdLookupFactory' ) ) {
// MW1.37+
$uidLookup = MediaWikiServices::getInstance()->getCentralIdLookupFactory()->getLookup();