MediaWiki REL1_40
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 $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
44 $dbw = $lb->getConnectionRef( DB_PRIMARY );
45
46 $dbw->update(
47 'user',
48 // SET
49 [ 'user_editcount' => $this->params['editCount'] ],
50 // WHERE
51 [
52 'user_id' => $this->params['userId'],
53 'user_editcount IS NULL OR user_editcount < ' . $dbw->addQuotes( $this->params['editCount'] )
54 ],
55 __METHOD__
56 );
57
58 return true;
59 }
60}
Class to both describe a background job and handle jobs.
Definition Job.php:39
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.
const DB_PRIMARY
Definition defines.php:28