35 parent::__construct(
'userOptionsUpdate',
$params );
36 $this->removeDuplicates =
true;
39 public function run() {
40 if ( !$this->params[
'options'] ) {
45 $user->load( $user::READ_EXCLUSIVE );
46 if ( !$user->isRegistered() ) {
50 $userOptionsManager = MediaWikiServices::getInstance()
51 ->getUserOptionsManager();
52 foreach ( $this->params[
'options'] as $name => $value ) {
53 $userOptionsManager->setOption( $user, $name, $value );
56 $user->saveSettings();
Class to both describe a background job and handle jobs.
array $params
Array of job parameters.
Job that updates a user's preferences.
__construct(array $params)
static newFromId( $id)
Static factory method for creation from a given user ID.
Interface for generic jobs only uses the parameters field and are JSON serializable.