mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
Inject service UserOptionsManager into Hooks
Change-Id: I39f7e113a74fa9e15259638ee1900da98eaa4a3a
This commit is contained in:
parent
5f0100872d
commit
62a8ce1d48
|
@ -60,7 +60,10 @@
|
|||
]
|
||||
},
|
||||
"main": {
|
||||
"class": "MediaWiki\\Extension\\Math\\Hooks"
|
||||
"class": "MediaWiki\\Extension\\Math\\Hooks",
|
||||
"services": [
|
||||
"UserOptionsManager"
|
||||
]
|
||||
},
|
||||
"schema": {
|
||||
"class": "MediaWiki\\Extension\\Math\\HookHandlers\\SchemaHooksHandler"
|
||||
|
|
|
@ -15,14 +15,21 @@ use Maintenance;
|
|||
use MediaWiki\Config\ConfigException;
|
||||
use MediaWiki\Context\RequestContext;
|
||||
use MediaWiki\Hook\MaintenanceRefreshLinksInitHook;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Settings\SettingsBuilder;
|
||||
use MediaWiki\SpecialPage\Hook\SpecialPage_initListHook;
|
||||
use MediaWiki\User\Options\UserOptionsManager;
|
||||
|
||||
class Hooks implements
|
||||
SpecialPage_initListHook,
|
||||
MaintenanceRefreshLinksInitHook
|
||||
{
|
||||
private UserOptionsManager $userOptionsManager;
|
||||
|
||||
public function __construct(
|
||||
UserOptionsManager $userOptionsManager
|
||||
) {
|
||||
$this->userOptionsManager = $userOptionsManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension registration callback, used to apply dynamic defaults for configuration variables.
|
||||
|
@ -97,8 +104,7 @@ class Hooks implements
|
|||
$user = RequestContext::getMain()->getUser();
|
||||
|
||||
// Don't parse LaTeX to improve performance
|
||||
MediaWikiServices::getInstance()->getUserOptionsManager()
|
||||
->setOption( $user, 'math', MathConfig::MODE_SOURCE );
|
||||
$this->userOptionsManager->setOption( $user, 'math', MathConfig::MODE_SOURCE );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue