2023-08-29 18:03:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Skins\Vector;
|
|
|
|
|
|
|
|
use MediaWiki\Extension\CentralAuth\Hooks\CentralAuthIsUIReloadRecommendedHook;
|
2023-11-29 12:42:02 +00:00
|
|
|
use MediaWiki\User\Options\UserOptionsLookup;
|
2024-01-02 19:54:08 +00:00
|
|
|
use MediaWiki\User\User;
|
2023-08-29 18:03:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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 ) {
|
2024-01-04 12:12:03 +00:00
|
|
|
if (
|
|
|
|
$this->userOptionsLookup->getDefaultOption( 'skin', $user ) ===
|
|
|
|
Constants::SKIN_NAME_MODERN
|
|
|
|
) {
|
2023-08-29 18:03:09 +00:00
|
|
|
// Vector 2022 does not support updating the UI without reloading the page (T345112)
|
|
|
|
$recommendReload = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|