mediawiki-skins-Vector/includes/CentralAuthHooks.php
Martin Urbanec aa13694fea Support conditional user defaults
Thanks to T321527, MediaWiki makes it possible for default
values of user properties to vary by user.

Depends-On: I1549c3137e66801c85e03e46427e27da333d68e2
Bug: T354329
Change-Id: Ib7c80f0b065617f9e76315eb4a652486681247cc
2024-01-04 13:12:03 +01:00

35 lines
835 B
PHP

<?php
namespace MediaWiki\Skins\Vector;
use MediaWiki\Extension\CentralAuth\Hooks\CentralAuthIsUIReloadRecommendedHook;
use MediaWiki\User\Options\UserOptionsLookup;
use MediaWiki\User\User;
/**
* @package Vector
* @internal
*/
class CentralAuthHooks implements CentralAuthIsUIReloadRecommendedHook {
private UserOptionsLookup $userOptionsLookup;
public function __construct( UserOptionsLookup $userOptionsLookup ) {
$this->userOptionsLookup = $userOptionsLookup;
}
/**
* @inheritDoc
*/
public function onCentralAuthIsUIReloadRecommended( User $user, bool &$recommendReload ) {
if (
$this->userOptionsLookup->getDefaultOption( 'skin', $user ) ===
Constants::SKIN_NAME_MODERN
) {
// Vector 2022 does not support updating the UI without reloading the page (T345112)
$recommendReload = true;
}
}
}