X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fchangetags%2FChangeTags.php;h=b28983f9ef06de4f982edeb1670c949a92ab77cd;hb=d4cc4f2b4f20725725a9345c7a4b7906e5aa66d2;hp=8dc63e506d33f1ff23344d05c06de59573879935;hpb=e2e9117a51f5c08e32817f474e1c7b2882307785;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 8dc63e506d..b28983f9ef 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -351,13 +351,15 @@ class ChangeTags { foreach ( $tagsToAdd as $tag ) { $changeTagMapping[$tag] = $changeTagDefStore->acquireId( $tag ); } - - $dbw->update( - 'change_tag_def', - [ 'ctd_count = ctd_count + 1' ], - [ 'ctd_name' => $tagsToAdd ], - __METHOD__ - ); + // T207881: update the counts at the end of the transaction + $dbw->onTransactionPreCommitOrIdle( function () use ( $dbw, $tagsToAdd ) { + $dbw->update( + 'change_tag_def', + [ 'ctd_count = ctd_count + 1' ], + [ 'ctd_name' => $tagsToAdd ], + __METHOD__ + ); + } ); } $tagsRows = []; @@ -408,18 +410,21 @@ class ChangeTags { ); $dbw->delete( 'change_tag', $conds, __METHOD__ ); if ( $dbw->affectedRows() && $wgChangeTagsSchemaMigrationStage > MIGRATION_OLD ) { - $dbw->update( - 'change_tag_def', - [ 'ctd_count = ctd_count - 1' ], - [ 'ctd_name' => $tag ], - __METHOD__ - ); - - $dbw->delete( - 'change_tag_def', - [ 'ctd_name' => $tag, 'ctd_count' => 0, 'ctd_user_defined' => 0 ], - __METHOD__ - ); + // T207881: update the counts at the end of the transaction + $dbw->onTransactionPreCommitOrIdle( function () use ( $dbw, $tag ) { + $dbw->update( + 'change_tag_def', + [ 'ctd_count = ctd_count - 1' ], + [ 'ctd_name' => $tag ], + __METHOD__ + ); + + $dbw->delete( + 'change_tag_def', + [ 'ctd_name' => $tag, 'ctd_count' => 0, 'ctd_user_defined' => 0 ], + __METHOD__ + ); + } ); } } } @@ -807,15 +812,15 @@ class ChangeTags { $tagTables[] = 'change_tag'; if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_WRITE_BOTH ) { $tagTables[] = 'change_tag_def'; - $join_cond_ts_tags = [ $join_cond, 'ct_tag_id=ctd_id' ]; + $join_cond_ts_tags = [ 'change_tag_def' => [ 'INNER JOIN', 'ct_tag_id=ctd_id' ] ]; $field = 'ctd_name'; } else { $field = 'ct_tag'; - $join_cond_ts_tags = $join_cond; + $join_cond_ts_tags = []; } $fields['ts_tags'] = wfGetDB( DB_REPLICA )->buildGroupConcatField( - ',', $tagTables, $field, $join_cond_ts_tags + ',', $tagTables, $field, $join_cond, $join_cond_ts_tags ); if ( $wgUseTagFilter && $filter_tag ) { @@ -836,7 +841,10 @@ class ChangeTags { break; }; } - $conds['ct_tag_id'] = $filterTagIds; + + if ( $filterTagIds !== [] ) { + $conds['ct_tag_id'] = $filterTagIds; + } } else { $conds['ct_tag'] = $filter_tag; }