Avoid using User::setOption()

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

Bug: T277818
Change-Id: Idd89847f2363645862b1d81488d7eb5727d8baab
This commit is contained in:
ZabeMath 2021-04-02 21:06:06 +02:00
parent d9e7ea40bb
commit 8d8e0e7da1

View file

@ -108,10 +108,11 @@ class MigratePreferences extends LoggedUpdateMaintenance {
private function updateUser( $userRow, array &$options ) {
if ( $userRow->user_id && $options ) {
$user = User::newFromRow( $userRow );
$userOptionsManager = MediaWikiServices::getInstance()->getUserOptionsManager();
foreach ( $options as $option => $value ) {
$user->setOption( $option, $value );
$userOptionsManager->setOption( $user, $option, $value );
}
$user->saveSettings();
$userOptionsManager->saveOptions( $user );
}
$count = count( $options );
$options = [];