MediaWiki master
UserEditCountInitJob.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\User;
8
12
27
28 public function __construct( array $params ) {
29 parent::__construct( 'userEditCountInit', $params );
30 $this->removeDuplicates = true;
31 }
32
34 public function run() {
35 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
36
37 $dbw->newUpdateQueryBuilder()
38 ->update( 'user' )
39 ->set( [ 'user_editcount' => $this->params['editCount'] ] )
40 ->where( [
41 'user_id' => $this->params['userId'],
42 $dbw->expr( 'user_editcount', '=', null )->or( 'user_editcount', '<', $this->params['editCount'] )
43 ] )
44 ->caller( __METHOD__ )
45 ->execute();
46
47 return true;
48 }
49}
Describe and execute a background job.
Definition Job.php:28
array $params
Array of job parameters.
Definition Job.php:33
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
Job that initializes an user's edit count.
run()
Run the job.If this method returns false or completes exceptionally, the job runner will retry execut...
Interface for generic jobs only uses the parameters field and are JSON serializable.