Avoid using User::setOption()

User::setOption() is deprecated and should be replaced with
UserOptionsManager::setOption()

Bug: T277818
Change-Id: I5ac58c4be5046d4457de24b63b062aa238e972b6
This commit is contained in:
Alexander Vorwerk
2021-08-12 00:25:32 +02:00
committed by jenkins-bot
parent 77b61af6b8
commit 0d9e1b134a
3 changed files with 30 additions and 4 deletions

View File

@@ -34,7 +34,9 @@ class ULSCompactLinksDisablePref extends Maintenance {
public function execute() {
$dbr = wfGetDB( DB_REPLICA, 'vslow' );
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$services = MediaWikiServices::getInstance();
$lbFactory = $services->getDBLoadBalancerFactory();
$userOptionsManager = $services->getUserOptionsManager();
$really = $this->hasOption( 'really' );
@@ -102,7 +104,7 @@ class ULSCompactLinksDisablePref extends Maintenance {
$user->load( User::READ_LATEST );
if ( $really ) {
$user->setOption( 'compact-language-links', 0 );
$userOptionsManager->setOption( $user, 'compact-language-links', 0 );
$user->saveSettings();
}