MediaWiki master
UserEditCountInitJob.php
Go to the documentation of this file.
1<?php
24
39
40 public function __construct( array $params ) {
41 parent::__construct( 'userEditCountInit', $params );
42 $this->removeDuplicates = true;
43 }
44
45 public function run() {
46 $dbw = MediaWikiServices::getInstance()->getConnectionProvider()->getPrimaryDatabase();
47
48 $dbw->newUpdateQueryBuilder()
49 ->update( 'user' )
50 ->set( [ 'user_editcount' => $this->params['editCount'] ] )
51 ->where( [
52 'user_id' => $this->params['userId'],
53 $dbw->expr( 'user_editcount', '=', null )->or( 'user_editcount', '<', $this->params['editCount'] )
54 ] )
55 ->caller( __METHOD__ )->execute();
56
57 return true;
58 }
59}
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.