MediaWiki master
UserEditCountInitJob.php
Go to the documentation of this file.
1<?php
22
36
37 public function __construct( array $params ) {
38 parent::__construct( 'userEditCountInit', $params );
39 $this->removeDuplicates = true;
40 }
41
42 public function run() {
43 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
44
45 $dbw->newUpdateQueryBuilder()
46 ->update( 'user' )
47 ->set( [ 'user_editcount' => $this->params['editCount'] ] )
48 ->where( [
49 'user_id' => $this->params['userId'],
50 $dbw->expr( 'user_editcount', '=', null )->or( 'user_editcount', '<', $this->params['editCount'] )
51 ] )
52 ->caller( __METHOD__ )->execute();
53
54 return true;
55 }
56}
Class to both describe a background job and handle jobs.
Definition Job.php:40
Service locator for MediaWiki core services.
Job that initializes an user's edit count.
Interface for generic jobs only uses the parameters field and are JSON serializable.