MediaWiki master
UserEditCountInitJob.php
Go to the documentation of this file.
1<?php
10
25
26 public function __construct( array $params ) {
27 parent::__construct( 'userEditCountInit', $params );
28 $this->removeDuplicates = true;
29 }
30
32 public function run() {
33 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
34
35 $dbw->newUpdateQueryBuilder()
36 ->update( 'user' )
37 ->set( [ 'user_editcount' => $this->params['editCount'] ] )
38 ->where( [
39 'user_id' => $this->params['userId'],
40 $dbw->expr( 'user_editcount', '=', null )->or( 'user_editcount', '<', $this->params['editCount'] )
41 ] )
42 ->caller( __METHOD__ )->execute();
43
44 return true;
45 }
46}
Describe and execute a background job.
Definition Job.php:27
Service locator for MediaWiki core services.
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.