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}
array $params
The job parameters.
Describe and execute a background job.
Definition Job.php:41
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.