Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CentralAuthHooks
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 onCentralAuthIsUIReloadRecommended
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\Skins\Vector;
4
5use MediaWiki\Extension\CentralAuth\Hooks\CentralAuthIsUIReloadRecommendedHook;
6use MediaWiki\User\Options\UserOptionsLookup;
7use MediaWiki\User\User;
8
9/**
10 * @package Vector
11 * @internal
12 */
13class CentralAuthHooks implements CentralAuthIsUIReloadRecommendedHook {
14
15    private UserOptionsLookup $userOptionsLookup;
16
17    public function __construct( UserOptionsLookup $userOptionsLookup ) {
18        $this->userOptionsLookup = $userOptionsLookup;
19    }
20
21    /**
22     * @inheritDoc
23     */
24    public function onCentralAuthIsUIReloadRecommended( User $user, bool &$recommendReload ) {
25        if (
26            $this->userOptionsLookup->getDefaultOption( 'skin', $user ) ===
27            Constants::SKIN_NAME_MODERN
28        ) {
29            // Vector 2022 does not support updating the UI without reloading the page (T345112)
30            $recommendReload = true;
31        }
32    }
33
34}