54 Assert::parameterType( __CLASS__, $update,
'$update' );
55 '@phan-var UserEditCountUpdate $update';
57 foreach ( $update->infoByUser as $userId => $info ) {
58 if ( !isset( $this->infoByUser[$userId] ) ) {
59 $this->infoByUser[$userId] = $info;
61 $this->infoByUser[$userId]->merge( $info );
70 $mwServices = MediaWikiServices::getInstance();
71 $lb = $mwServices->getDBLoadBalancer();
73 $editTracker = $mwServices->getUserEditTracker();
76 (
new AutoCommitUpdate( $dbw, __METHOD__,
function () use ( $lb, $dbw, $fname, $editTracker ) {
77 foreach ( $this->infoByUser as $userId => $info ) {
80 [
'user_editcount=user_editcount+' . (
int)$info->getIncrement() ],
81 [
'user_id' => $userId,
'user_editcount IS NOT NULL' ],
85 if ( $dbw->affectedRows() == 0 ) {
92 $dbr->flushSnapshot( $fname );
93 $lb->waitForPrimaryPos(
$dbr );
94 $editTracker->initializeUserEditCount( $info->getUser() );
98 $editTracker->clearUserEditCache( $info->getUser() );
102 $hookRunner =
new HookRunner( $mwServices->getHookContainer() );
103 $hookRunner->onUserEditCountUpdate( array_values( $this->infoByUser ) );