mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-27 17:20:40 +00:00
a0ca1d89c6
Changes to the use statements done automatically via script Addition of missing use statements done manually Change-Id: Iad87245bf8082193be72f7e482f29e9f1bad11fc
29 lines
799 B
PHP
29 lines
799 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\Notifications\Push;
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
use MediaWiki\User\CentralId\CentralIdLookup;
|
|
use MediaWiki\User\UserIdentity;
|
|
|
|
class Utils {
|
|
|
|
/**
|
|
* Attempt to get a unique ID for the specified user, accounting for installations both with
|
|
* and without CentralAuth: Return the user's central ID, if available. If there is no central
|
|
* user associated with the local user (i.e., centralIdFromLocalUser returns 0), fall back to
|
|
* returning the local user ID.
|
|
* @param UserIdentity $user
|
|
* @return int
|
|
*/
|
|
public static function getPushUserId( UserIdentity $user ): int {
|
|
return MediaWikiServices::getInstance()
|
|
->getCentralIdLookup()
|
|
->centralIdFromLocalUser(
|
|
$user,
|
|
CentralIdLookup::AUDIENCE_RAW
|
|
) ?: $user->getId();
|
|
}
|
|
|
|
}
|