X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=blobdiff_plain;f=includes%2Fchangetags%2FChangeTags.php;h=787464084937db0b77ef63cd1715dc51afb8b946;hb=130ec2523df12a3ca2fe0d422163696d09fcea08;hp=d019f41cea0fc1ab973b3103f0723ebd6bd012ad;hpb=1abf584017a839aff886457bf854e20b5842c7d0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index d019f41cea..7874640849 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -213,7 +213,7 @@ class ChangeTags { * @param int|null $rc_id The rc_id of the change to add the tags to * @param int|null $rev_id The rev_id of the change to add the tags to * @param int|null $log_id The log_id of the change to add the tags to - * @param string $params Params to put in the ct_params field of table 'change_tag' + * @param string|null $params Params to put in the ct_params field of table 'change_tag' * @param RecentChange|null $rc Recent change, in case the tagging accompanies the action * (this should normally be the case) * @@ -244,7 +244,7 @@ class ChangeTags { * Pass a variable whose value is null if the rev_id is not relevant or unknown. * @param int|null &$log_id The log_id of the change to add the tags to. * Pass a variable whose value is null if the log_id is not relevant or unknown. - * @param string $params Params to put in the ct_params field of table + * @param string|null $params Params to put in the ct_params field of table * 'change_tag' when adding tags * @param RecentChange|null $rc Recent change being tagged, in case the tagging accompanies * the action @@ -346,31 +346,18 @@ class ChangeTags { if ( count( $tagsToAdd ) ) { $changeTagMapping = []; if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_OLD ) { - $tagDefRows = []; + $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); + foreach ( $tagsToAdd as $tag ) { - $tagDefRows[] = [ - 'ctd_name' => $tag, - 'ctd_user_defined' => 0, - 'ctd_count' => 1 - ]; + $changeTagMapping[$tag] = $changeTagDefStore->acquireId( $tag ); } - $dbw->upsert( + $dbw->update( 'change_tag_def', - $tagDefRows, - [ 'ctd_name' ], [ 'ctd_count = ctd_count + 1' ], + [ 'ctd_name' => $tagsToAdd ], __METHOD__ ); - - $res = $dbw->select( - 'change_tag_def', - [ 'ctd_name', 'ctd_id' ], - [ 'ctd_name' => $tagsToAdd ] - ); - foreach ( $res as $row ) { - $changeTagMapping[$row->ctd_name] = $row->ctd_id; - } } $tagsRows = []; @@ -954,7 +941,7 @@ class ChangeTags { * @param string $tag * @param string $reason * @param User $user Who to attribute the action to - * @param int $tagCount For deletion only, how many usages the tag had before + * @param int|null $tagCount For deletion only, how many usages the tag had before * it was deleted. * @param array $logEntryTags Change tags to apply to the entry * that will be created in the tag management log