uses are in active use.
&$tags: list of all active tags. Append to this array.
+'ChangeTagsAfterUpdateTags': Called after tags have been updated with the
+ChangeTags::updateTags function. Params:
+$addedTags: tags effectively added in the update
+$removedTags: tags effectively removed in the update
+$prevTags: tags that were present prior to the update
+$rc_id: recentchanges table id
+$rev_id: revision table id
+$log_id: logging table id
+$params: tag params
+$rc: RecentChange being tagged when the tagging accompanies the action or null
+$user: User who performed the tagging when the tagging is subsequent to the action or null
+
'Collation::factory': Called if $wgCategoryCollation is an unknown collation.
$collationName: Name of the collation in question
&$collationObject: Null. Replace with a subclass of the Collation class that
* @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 RecentChange|null $rc Recent change, in case the tagging accompanies the action
+ * (this should normally be the case)
*
* @throws MWException
* @return bool False if no changes are made, otherwise true
*/
public static function addTags( $tags, $rc_id = null, $rev_id = null,
- $log_id = null, $params = null
+ $log_id = null, $params = null, RecentChange $rc = null
) {
- $result = self::updateTags( $tags, null, $rc_id, $rev_id, $log_id, $params );
+ $result = self::updateTags( $tags, null, $rc_id, $rev_id, $log_id, $params, $rc );
return (bool)$result[0];
}
* 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
* 'change_tag' when adding tags
+ * @param RecentChange|null $rc Recent change being tagged, in case the tagging accompanies
+ * the action
+ * @param User|null $user Tagging user, in case the tagging is subsequent to the tagged action
*
* @throws MWException When $rc_id, $rev_id and $log_id are all null
* @return array Index 0 is an array of tags actually added, index 1 is an
*
* @since 1.25
*/
- public static function updateTags(
- $tagsToAdd, $tagsToRemove,
- &$rc_id = null, &$rev_id = null, &$log_id = null, $params = null
+ public static function updateTags( $tagsToAdd, $tagsToRemove, &$rc_id = null,
+ &$rev_id = null, &$log_id = null, $params = null, RecentChange $rc = null,
+ User $user = null
) {
$tagsToAdd = array_filter( (array)$tagsToAdd ); // Make sure we're submitting all tags...
}
self::purgeTagUsageCache();
+
+ Hooks::run( 'ChangeTagsAfterUpdateTags', [ $tagsToAdd, $tagsToRemove, $prevTags,
+ $rc_id, $rev_id, $log_id, $params, $rc, $user ] );
+
return [ $tagsToAdd, $tagsToRemove, $prevTags ];
}
// do it!
list( $tagsAdded, $tagsRemoved, $initialTags ) = self::updateTags( $tagsToAdd,
- $tagsToRemove, $rc_id, $rev_id, $log_id, $params );
+ $tagsToRemove, $rc_id, $rev_id, $log_id, $params, null, $user );
if ( !$tagsAdded && !$tagsRemoved ) {
// no-op, don't log it
return Status::newGood( (object)[