MediaWiki REL1_33
|
Static Public Member Functions | |
static | activateTagWithChecks ( $tag, $reason, User $user, $ignoreWarnings=false, array $logEntryTags=[]) |
Activates a tag, checking whether it is allowed first, and adding a log entry afterwards. | |
static | addTags ( $tags, $rc_id=null, $rev_id=null, $log_id=null, $params=null, RecentChange $rc=null) |
Add tags to a change given its rc_id, rev_id and/or log_id. | |
static | addTagsAccompanyingChangeWithChecks (array $tags, $rc_id, $rev_id, $log_id, $params, User $user) |
Adds tags to a given change, checking whether it is allowed first, but without adding a log entry. | |
static | buildTagFilterSelector ( $selected='', $ooui=false, IContextSource $context=null) |
Build a text box to select a change tag. | |
static | canActivateTag ( $tag, User $user=null) |
Is it OK to allow the user to activate this tag? | |
static | canAddTagsAccompanyingChange (array $tags, User $user=null) |
Is it OK to allow the user to apply all the specified tags at the same time as they edit/make the change? | |
static | canCreateTag ( $tag, User $user=null) |
Is it OK to allow the user to create this tag? | |
static | canDeactivateTag ( $tag, User $user=null) |
Is it OK to allow the user to deactivate this tag? | |
static | canDeleteTag ( $tag, User $user=null) |
Is it OK to allow the user to delete this tag? | |
static | canUpdateTags (array $tagsToAdd, array $tagsToRemove, User $user=null) |
Is it OK to allow the user to adds and remove the given tags tags to/from a change? | |
static | createTagWithChecks ( $tag, $reason, User $user, $ignoreWarnings=false, array $logEntryTags=[]) |
Creates a tag by adding it to change_tag_def table. | |
static | deactivateTagWithChecks ( $tag, $reason, User $user, $ignoreWarnings=false, array $logEntryTags=[]) |
Deactivates a tag, checking whether it is allowed first, and adding a log entry afterwards. | |
static | defineTag ( $tag) |
Set ctd_user_defined = 1 in change_tag_def without checking that the tag name is valid. | |
static | deleteTagEverywhere ( $tag) |
Permanently removes all traces of a tag from the DB. | |
static | deleteTagWithChecks ( $tag, $reason, User $user, $ignoreWarnings=false, array $logEntryTags=[]) |
Deletes a tag, checking whether it is allowed first, and adding a log entry afterwards. | |
static | formatSummaryRow ( $tags, $page, IContextSource $context=null) |
Creates HTML for the given tags. | |
static | getSoftwareTags ( $all=false) |
Loads defined core tags, checks for invalid types (if not array), and filters for supported and enabled (if $all is false) tags only. | |
static | isTagNameValid ( $tag) |
Is the tag name valid? | |
static | listDefinedTags () |
Basically lists defined tags which count even if they aren't applied to anything. | |
static | listExplicitlyDefinedTags () |
Lists tags explicitly defined in the change_tag_def table of the database. | |
static | listSoftwareActivatedTags () |
Lists those tags which core or extensions report as being "active". | |
static | listSoftwareDefinedTags () |
Lists tags defined by core or extensions using the ListDefinedTags hook. | |
static | makeTagSummarySubquery ( $tables) |
Make the tag summary subquery based on the given tables and return it. | |
static | modifyDisplayQuery (&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag='') |
Applies all tags-related changes to a query. | |
static | purgeTagCacheAll () |
Invalidates the short-term cache of defined tags used by the list*DefinedTags functions, as well as the tag statistics cache. | |
static | purgeTagUsageCache () |
Invalidates the tag statistics cache only. | |
static | showTagEditingUI (User $user) |
Indicate whether change tag editing UI is relevant. | |
static | tagDescription ( $tag, MessageLocalizer $context) |
Get a short description for a tag. | |
static | tagLongDescriptionMessage ( $tag, MessageLocalizer $context) |
Get the message object for the tag's long description. | |
static | tagUsageStatistics () |
Returns a map of any tags used on the wiki to number of edits tagged with them, ordered descending by the hitcount. | |
static | truncateTagDescription ( $tag, $length, IContextSource $context) |
Get truncated message for the tag's long description. | |
static | undefineTag ( $tag) |
Update ctd_user_defined = 0 field in change_tag_def. | |
static | updateTags ( $tagsToAdd, $tagsToRemove, &$rc_id=null, &$rev_id=null, &$log_id=null, $params=null, RecentChange $rc=null, User $user=null) |
Add and remove tags to/from a change given its rc_id, rev_id and/or log_id, without verifying that the tags exist or are valid. | |
static | updateTagsWithChecks ( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id, $log_id, $params, $reason, User $user) |
Adds and/or removes tags to/from a given change, checking whether it is allowed first, and adding a log entry afterwards. | |
Public Attributes | |
const | MAX_DELETE_USES = 5000 |
Can't delete tags with more than this many uses. | |
Static Protected Member Functions | |
static | logTagManagementAction ( $action, $tag, $reason, User $user, $tagCount=null, array $logEntryTags=[]) |
Writes a tag action into the tag management log. | |
static | restrictedTagError ( $msgOne, $msgMulti, $tags) |
Helper function to generate a fatal status with a 'not-allowed' type error. | |
Static Private Member Functions | |
static | getPrevTags ( $rc_id=null, $log_id=null, $rev_id=null) |
Static Private Attributes | |
static | $definedSoftwareTags |
A list of tags defined and used by MediaWiki itself. | |
Definition at line 28 of file ChangeTags.php.
|
static |
Activates a tag, checking whether it is allowed first, and adding a log entry afterwards.
Includes a call to ChangeTag::canActivateTag(), so your code doesn't need to do that.
string | $tag | |
string | $reason | |
User | $user | Who to give credit for the action |
bool | $ignoreWarnings | Can be used for API interaction, default false |
array | $logEntryTags | Change tags to apply to the entry that will be created in the tag management log |
Definition at line 1015 of file ChangeTags.php.
References $user, canActivateTag(), defineTag(), and logTagManagementAction().
|
static |
Add tags to a change given its rc_id, rev_id and/or log_id.
string | string[] | $tags | Tags to add to the change |
int | null | $rc_id | The rc_id of the change to add the tags to |
int | null | $rev_id | The rev_id of the change to add the tags to |
int | null | $log_id | The log_id of the change to add the tags to |
string | null | $params | Params to put in the ct_params field of table 'change_tag' |
RecentChange | null | $rc | Recent change, in case the tagging accompanies the action (this should normally be the case) |
MWException |
Definition at line 226 of file ChangeTags.php.
References $params, and updateTags().
Referenced by addTagsAccompanyingChangeWithChecks(), MovePage\moveToInternal(), ApiTag\processIndividual(), ManualLogEntry\publish(), and RecentChange\save().
|
static |
Adds tags to a given change, checking whether it is allowed first, but without adding a log entry.
Useful for cases where the tag is being added along with the action that generated the change (e.g. tagging an edit as it is being made).
Extensions should not use this function, unless directly handling a user request to add a particular tag. Normally, extensions should call ChangeTags::updateTags() instead.
array | $tags | Tags to apply |
int | null | $rc_id | The rc_id of the change to add the tags to |
int | null | $rev_id | The rev_id of the change to add the tags to |
int | null | $log_id | The log_id of the change to add the tags to |
string | $params | Params to put in the ct_params field of table 'change_tag' when adding tags |
User | $user | Who to give credit for the action |
Definition at line 522 of file ChangeTags.php.
References $params, $user, addTags(), and canAddTagsAccompanyingChange().
|
static |
Build a text box to select a change tag.
string | $selected | Tag to select by default |
bool | $ooui | Use an OOUI TextInputWidget as selector instead of a non-OOUI input field You need to call OutputPage::enableOOUI() yourself. |
IContextSource | null | $context |
Definition at line 830 of file ChangeTags.php.
References $context, and $data.
Referenced by HTMLTagFilter\getDiv(), SpecialRecentChanges\getExtraOptions(), SpecialContributions\getForm(), HTMLTagFilter\getOOUI(), HTMLTagFilter\getTableRow(), and HistoryAction\onView().
Is it OK to allow the user to activate this tag?
string | $tag | Tag that you are interested in activating |
User | null | $user | User whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
Definition at line 972 of file ChangeTags.php.
References $user, listDefinedTags(), and tagUsageStatistics().
Referenced by activateTagWithChecks(), and SpecialTags\doTagRow().
Is it OK to allow the user to apply all the specified tags at the same time as they edit/make the change?
Extensions should not use this function, unless directly handling a user request to add a tag to a revision or log entry that the user is making.
array | $tags | Tags that you are interested in applying |
User | null | $user | User whose permission you wish to check, or null to check for a generic non-blocked user with the relevant rights |
Definition at line 481 of file ChangeTags.php.
References $user, listExplicitlyDefinedTags(), and restrictedTagError().
Referenced by addTagsAccompanyingChangeWithChecks(), ApiBlock\execute(), ApiDelete\execute(), ApiEditPage\execute(), ApiImageRotate\execute(), ApiImport\execute(), ApiManageTags\execute(), ApiMove\execute(), ApiPatrol\execute(), ApiProtect\execute(), ApiRevisionDelete\execute(), ApiRollback\execute(), ApiSetPageLanguage\execute(), ApiTag\execute(), ApiUnblock\execute(), ApiUndelete\execute(), ApiUserrights\execute(), ApiBase\getParameterFromSettings(), EditPage\internalAttemptSave(), ApiUpload\performUpload(), and SpecialUpload\processUpload().
Is it OK to allow the user to create this tag?
Extensions should NOT use this function. In most cases, a tag can be defined using the ListDefinedTags hook without any checking.
string | $tag | Tag that you are interested in creating |
User | null | $user | User whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
Definition at line 1141 of file ChangeTags.php.
References $user, isTagNameValid(), and tagUsageStatistics().
Referenced by createTagWithChecks().
Is it OK to allow the user to deactivate this tag?
string | $tag | Tag that you are interested in deactivating |
User | null | $user | User whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
Definition at line 1044 of file ChangeTags.php.
References $user, and listExplicitlyDefinedTags().
Referenced by deactivateTagWithChecks(), and SpecialTags\doTagRow().
Is it OK to allow the user to delete this tag?
string | $tag | Tag that you are interested in deleting |
User | null | $user | User whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
Definition at line 1257 of file ChangeTags.php.
References $user, listSoftwareDefinedTags(), and tagUsageStatistics().
Referenced by deleteTagWithChecks(), SpecialTags\doTagRow(), and SpecialTags\showDeleteTagForm().
|
static |
Is it OK to allow the user to adds and remove the given tags tags to/from a change?
Extensions should not use this function, unless directly handling a user request to add or remove tags from an existing revision or log entry.
array | $tagsToAdd | Tags that you are interested in adding |
array | $tagsToRemove | Tags that you are interested in removing |
User | null | $user | User whose permission you wish to check, or null to check for a generic non-blocked user with the relevant rights |
Definition at line 552 of file ChangeTags.php.
References $user, listExplicitlyDefinedTags(), listSoftwareDefinedTags(), and restrictedTagError().
Referenced by updateTagsWithChecks().
|
static |
Creates a tag by adding it to change_tag_def
table.
Extensions should NOT use this function; they can use the ListDefinedTags hook instead.
Includes a call to ChangeTag::canCreateTag(), so your code doesn't need to do that.
string | $tag | |
string | $reason | |
User | $user | Who to give credit for the action |
bool | $ignoreWarnings | Can be used for API interaction, default false |
array | $logEntryTags | Change tags to apply to the entry that will be created in the tag management log |
Definition at line 1186 of file ChangeTags.php.
References $user, canCreateTag(), defineTag(), and logTagManagementAction().
Referenced by AddChangeTag\execute(), and SpecialTags\processCreateTagForm().
|
static |
Deactivates a tag, checking whether it is allowed first, and adding a log entry afterwards.
Includes a call to ChangeTag::canDeactivateTag(), so your code doesn't need to do that.
string | $tag | |
string | $reason | |
User | $user | Who to give credit for the action |
bool | $ignoreWarnings | Can be used for API interaction, default false |
array | $logEntryTags | Change tags to apply to the entry that will be created in the tag management log |
Definition at line 1078 of file ChangeTags.php.
References $user, canDeactivateTag(), logTagManagementAction(), and undefineTag().
|
static |
Set ctd_user_defined = 1 in change_tag_def without checking that the tag name is valid.
Extensions should NOT use this function; they can use the ListDefinedTags hook instead.
string | $tag | Tag to create |
Definition at line 877 of file ChangeTags.php.
References DB_MASTER, purgeTagCacheAll(), and wfGetDB().
Referenced by activateTagWithChecks(), createTagWithChecks(), ApiBaseTest\doGetParameterFromSettings(), ApiBlockTest\testBlockWithProhibitedTag(), ApiBlockTest\testBlockWithTag(), ApiDeleteTest\testDeleteWithoutTagPermission(), ApiDeleteTest\testDeleteWithTag(), ApiEditPageTest\testEditWithoutTagPermission(), ApiEditPageTest\testEditWithTag(), ChangeTagsTest\testListExplicitlyDefinedTags(), ApiMoveTest\testTagsNoPermission(), ApiUnblockTest\testUnblockWithProhibitedTag(), ApiUnblockTest\testUnblockWithTagNewBackend(), ApiUserrightsTest\testWithoutTagPermission(), and ApiUserrightsTest\testWithTag().
|
static |
Permanently removes all traces of a tag from the DB.
Good for removing misspelt or temporary tags.
This function should be directly called by maintenance scripts only, never by user-facing code. See deleteTagWithChecks() for functionality that can safely be exposed to users.
string | $tag | Tag to remove |
Definition at line 1218 of file ChangeTags.php.
References DB_MASTER, purgeTagCacheAll(), undefineTag(), wfDebug(), and wfGetDB().
Referenced by deleteTagWithChecks().
|
static |
Deletes a tag, checking whether it is allowed first, and adding a log entry afterwards.
Includes a call to ChangeTag::canDeleteTag(), so your code doesn't need to do that.
string | $tag | |
string | $reason | |
User | $user | Who to give credit for the action |
bool | $ignoreWarnings | Can be used for API interaction, default false |
array | $logEntryTags | Change tags to apply to the entry that will be created in the tag management log |
Definition at line 1307 of file ChangeTags.php.
References $user, canDeleteTag(), deleteTagEverywhere(), logTagManagementAction(), and tagUsageStatistics().
|
static |
Creates HTML for the given tags.
string | $tags | Comma-separated list of tags |
string | $page | A label for the type of action which is being displayed, for example: 'history', 'contributions' or 'newpages' |
IContextSource | null | $context |
Definition at line 93 of file ChangeTags.php.
References $context, as, and tagDescription().
Referenced by SpecialUndelete\diffHeader(), SpecialUndelete\formatRevisionRow(), SpecialNewpages\formatRow(), ContribsPager\formatRow(), ChangeTagsLogItem\getHTML(), ChangeTagsRevisionItem\getHTML(), RevDelRevisionItem\getHTML(), HistoryPager\historyLine(), ChangesList\insertTags(), LogEventsList\logLine(), and DifferenceEngine\showDiffPage().
Definition at line 431 of file ChangeTags.php.
References as, DB_MASTER, and wfGetDB().
Referenced by updateTags().
|
static |
Loads defined core tags, checks for invalid types (if not array), and filters for supported and enabled (if $all is false) tags only.
bool | $all | If true, return all valid defined tags. Otherwise, return only enabled ones. |
Definition at line 57 of file ChangeTags.php.
References $wgSoftwareTags, and wfWarn().
Referenced by WikiPage\commitRollback(), MediaWiki\Storage\PageUpdater\computeEffectiveTags(), ContentHandler\getChangeTag(), listSoftwareActivatedTags(), listSoftwareDefinedTags(), MovePage\moveToInternal(), and ChangeTagsTest\testGetSoftwareTags().
|
static |
Is the tag name valid?
string | $tag | Tag that you are interested in creating |
Definition at line 1105 of file ChangeTags.php.
References $title, and NS_MEDIAWIKI.
Referenced by canCreateTag().
|
static |
Basically lists defined tags which count even if they aren't applied to anything.
It returns a union of the results of listExplicitlyDefinedTags()
Definition at line 1372 of file ChangeTags.php.
References listExplicitlyDefinedTags(), and listSoftwareDefinedTags().
Referenced by canActivateTag(), and ApiFeedContributions\getAllowedParams().
|
static |
Lists tags explicitly defined in the change_tag_def
table of the database.
Tries memcached first.
Definition at line 1386 of file ChangeTags.php.
References $cache, $dbr, $fname, array(), DB_REPLICA, function, use, and wfGetDB().
Referenced by canAddTagsAccompanyingChange(), canDeactivateTag(), canUpdateTags(), ApiQueryTags\execute(), ChangesListSpecialPage\getChangeTagList(), ApiHelp\getHelpInternal(), ApiParamInfo\getModuleInfo(), SpecialEditTags\getTagSelect(), listDefinedTags(), SpecialTags\showTagList(), and ChangeTagsTest\testListExplicitlyDefinedTags().
|
static |
Lists those tags which core or extensions report as being "active".
Definition at line 1341 of file ChangeTags.php.
References $cache, array(), DB_REPLICA, function, getSoftwareTags(), use, and wfGetDB().
Referenced by ApiQueryTags\execute(), ChangesListSpecialPage\getChangeTagList(), SpecialTags\showDeleteTagForm(), and SpecialTags\showTagList().
|
static |
Lists tags defined by core or extensions using the ListDefinedTags hook.
Extensions need only define those tags they deem to be in active use.
Tries memcached first.
Definition at line 1424 of file ChangeTags.php.
References $cache, array(), DB_REPLICA, function, getSoftwareTags(), use, and wfGetDB().
Referenced by canDeleteTag(), canUpdateTags(), ApiQueryTags\execute(), listDefinedTags(), and SpecialTags\showTagList().
|
staticprotected |
Writes a tag action into the tag management log.
string | $action | |
string | $tag | |
string | $reason | |
User | $user | Who to attribute the action to |
int | null | $tagCount | For deletion only, how many usages the tag had before it was deleted. |
array | $logEntryTags | Change tags to apply to the entry that will be created in the tag management log |
Definition at line 938 of file ChangeTags.php.
References $params, $user, DB_MASTER, and wfGetDB().
Referenced by activateTagWithChecks(), createTagWithChecks(), deactivateTagWithChecks(), and deleteTagWithChecks().
|
static |
Make the tag summary subquery based on the given tables and return it.
string | array | $tables | Table names, see Database::select |
MWException | When unable to determine appropriate JOIN condition for tagging |
Definition at line 793 of file ChangeTags.php.
References $tables, array(), DB_REPLICA, and wfGetDB().
Referenced by ApiQueryDeletedrevs\execute(), ApiQueryLogEvents\execute(), WatchedItemQueryService\getWatchedItemsWithRCInfoQueryFields(), modifyDisplayQuery(), ApiQueryUserContribs\prepareQuery(), ApiQueryRecentChanges\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), ApiQueryDeletedRevisions\run(), and ApiQueryRevisions\run().
|
static |
Applies all tags-related changes to a query.
Handles selecting tags, and filtering. Needs $tables to be set up properly, so we can figure out which join conditions to use.
WARNING: If $filter_tag contains more than one tag, this function will add DISTINCT, which may cause performance problems for your query unless you put the ID field of your table at the end of the ORDER BY, and set a GROUP BY equal to the ORDER BY. For example, if you had ORDER BY foo_timestamp DESC, you will now need GROUP BY foo_timestamp, foo_id ORDER BY foo_timestamp DESC, foo_id DESC.
string | array | &$tables | Table names, see Database::select |
string | array | &$fields | Fields used in query, see Database::select |
string | array | &$conds | Conditions used in query, see Database::select |
array | &$join_conds | Join conditions, see Database::select |
string | array | &$options | Options, see Database::select |
string | array | $filter_tag | Tag(s) to select on |
MWException | When unable to determine appropriate JOIN condition for tagging |
Definition at line 728 of file ChangeTags.php.
References $options, $tables, $wgUseTagFilter, array(), as, and makeTagSummarySubquery().
Referenced by ChangesListSpecialPage\doMainQuery(), SpecialRecentChanges\doMainQuery(), SpecialWatchlist\doMainQuery(), SpecialRecentChangesLinked\doMainQuery(), ChangeTagsLogList\doQuery(), ChangeTagsRevisionList\doQuery(), RevDelArchiveList\doQuery(), RevDelRevisionList\doQuery(), HistoryPager\getQueryInfo(), LogPager\getQueryInfo(), ContribsPager\getQueryInfo(), NewPagesPager\getQueryInfo(), PageArchive\listRevisions(), and ChangeTagsTest\testModifyDisplayQuery().
|
static |
Invalidates the short-term cache of defined tags used by the list*DefinedTags functions, as well as the tag statistics cache.
Definition at line 1453 of file ChangeTags.php.
References $cache.
Referenced by defineTag(), deleteTagEverywhere(), and undefineTag().
|
static |
Invalidates the tag statistics cache only.
Definition at line 1468 of file ChangeTags.php.
References wfDeprecated().
|
staticprotected |
Helper function to generate a fatal status with a 'not-allowed' type error.
string | $msgOne | Message key to use in the case of one tag |
string | $msgMulti | Message key to use in the case of more than one tag |
array | $tags | Restricted tags (passed as $1 into the message, count of $tags passed as $2) |
Definition at line 461 of file ChangeTags.php.
References $lang.
Referenced by canAddTagsAccompanyingChange(), and canUpdateTags().
|
static |
Indicate whether change tag editing UI is relevant.
Returns true if the user has the necessary right and there are any editable tags defined.
This intentionally doesn't check "any addable || any deletable", because it seems like it would be more confusing than useful if the checkboxes suddenly showed up because some abuse filter stopped defining a tag and then suddenly disappeared when someone deleted all uses of that tag.
User | $user |
Definition at line 1510 of file ChangeTags.php.
References $user.
Referenced by LogEventsList\__construct(), HistoryPager\__construct(), and SpecialLog\getActionButtons().
|
static |
Get a short description for a tag.
Checks if message key "mediawiki:tag-$tag" exists. If it does not, returns the HTML-escaped tag name. Uses the message if the message exists, provided it is not disabled. If the message is disabled, we consider the tag hidden, and return false.
string | $tag | |
MessageLocalizer | $context |
Definition at line 148 of file ChangeTags.php.
References $context.
Referenced by SpecialTags\doTagRow(), ApiQueryTags\execute(), formatSummaryRow(), and ChangesListSpecialPage\getChangeTagList().
|
static |
Get the message object for the tag's long description.
Checks if message key "mediawiki:tag-$tag-description" exists. If it does not, or if message is disabled, returns false. Otherwise, returns the message object for the long description.
string | $tag | |
MessageLocalizer | $context |
Definition at line 175 of file ChangeTags.php.
References $context.
Referenced by truncateTagDescription().
|
static |
Returns a map of any tags used on the wiki to number of edits tagged with them, ordered descending by the hitcount.
This does not include tags defined somewhere that have never been applied.
Definition at line 1478 of file ChangeTags.php.
References $dbr, $out, $res, as, DB_REPLICA, and wfGetDB().
Referenced by canActivateTag(), canCreateTag(), canDeleteTag(), deleteTagWithChecks(), ApiQueryTags\execute(), ChangesListSpecialPage\getChangeTagList(), SpecialTags\showDeleteTagForm(), SpecialTags\showTagList(), and ChangeTagsTest\testTagUsageStatistics().
|
static |
Get truncated message for the tag's long description.
string | $tag | Tag name. |
int | $length | Maximum length of truncated message, including ellipsis. |
IContextSource | $context |
Definition at line 198 of file ChangeTags.php.
References $context, and tagLongDescriptionMessage().
Referenced by ChangesListSpecialPage\getChangeTagList().
|
static |
Update ctd_user_defined = 0 field in change_tag_def.
The tag may remain in use by extensions, and may still show up as 'defined' if an extension is setting it from the ListDefinedTags hook.
string | $tag | Tag to remove |
Definition at line 904 of file ChangeTags.php.
References DB_MASTER, purgeTagCacheAll(), and wfGetDB().
Referenced by deactivateTagWithChecks(), and deleteTagEverywhere().
|
static |
Add and remove tags to/from a change given its rc_id, rev_id and/or log_id, without verifying that the tags exist or are valid.
If a tag is present in both $tagsToAdd and $tagsToRemove, it will be removed.
This function should only be used by extensions to manipulate tags they have registered using the ListDefinedTags hook. When dealing with user input, call updateTagsWithChecks() instead.
string | array | null | $tagsToAdd | Tags to add to the change |
string | array | null | $tagsToRemove | Tags to remove from the change |
int | null | &$rc_id | The rc_id of the change to add the tags to. Pass a variable whose value is null if the rc_id is not relevant or unknown. |
int | null | &$rev_id | The rev_id of the change to add the tags to. Pass a variable whose value is null if the rev_id is not relevant or unknown. |
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. |
string | null | $params | Params to put in the ct_params field of table 'change_tag' when adding tags |
RecentChange | null | $rc | Recent change being tagged, in case the tagging accompanies the action |
User | null | $user | Tagging user, in case the tagging is subsequent to the tagged action |
MWException | When $rc_id, $rev_id and $log_id are all null |
Definition at line 263 of file ChangeTags.php.
References $fname, $params, $user, array(), as, DB_MASTER, getPrevTags(), use, and wfGetDB().
Referenced by addTags(), ChangeTagsTest\testDeleteTags(), ChangeTagsTest\testListExplicitlyDefinedTags(), ChangeTagsTest\testModifyDisplayQuery(), ChangeTagsTest\testTagUsageStatistics(), ChangeTagsTest\testUpdateTags(), ChangeTagsTest\testUpdateTagsDoNothingOnRepeatedCall(), ChangeTagsTest\testUpdateTagsSkipDuplicates(), and updateTagsWithChecks().
|
static |
Adds and/or removes tags to/from a given change, checking whether it is allowed first, and adding a log entry afterwards.
Includes a call to ChangeTags::canUpdateTags(), so your code doesn't need to do that. However, it doesn't check whether the *_id parameters are a valid combination. That is up to you to enforce. See ApiTag::execute() for an example.
Extensions should generally avoid this function. Call ChangeTags::updateTags() instead, unless directly handling a user request to add or remove tags from an existing revision or log entry.
array | null | $tagsToAdd | If none, pass array() or null |
array | null | $tagsToRemove | If none, pass array() or null |
int | null | $rc_id | The rc_id of the change to add the tags to |
int | null | $rev_id | The rev_id of the change to add the tags to |
int | null | $log_id | The log_id of the change to add the tags to |
string | $params | Params to put in the ct_params field of table 'change_tag' when adding tags |
string | $reason | Comment for the log |
User | $user | Who to give credit for the action |
Definition at line 619 of file ChangeTags.php.
References $params, $rev, $user, canUpdateTags(), DB_MASTER, list, Revision\newFromId(), RevDelLogList\suggestTarget(), updateTags(), and wfGetDB().
Referenced by ApiTag\processIndividual(), ChangeTagsLogList\updateChangeTagsOnAll(), and ChangeTagsRevisionList\updateChangeTagsOnAll().
|
staticprivate |
A list of tags defined and used by MediaWiki itself.
Definition at line 39 of file ChangeTags.php.
const ChangeTags::MAX_DELETE_USES = 5000 |
Can't delete tags with more than this many uses.
Similar in intent to the bigdelete user right
Definition at line 34 of file ChangeTags.php.