|
MediaWiki master
|
Recent changes tagging. More...
Static Public Member Functions | |
| static | activateTagWithChecks (string $tag, string $reason, Authority $performer, bool $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 | buildTagFilterSelector ( $selected='', $ooui=false, ?IContextSource $context=null, bool $activeOnly=self::TAG_SET_ACTIVE_ONLY, bool $useAllTags=self::USE_ALL_TAGS) |
| Build a text box to select a change tag. | |
| static | canActivateTag ( $tag, ?Authority $performer=null) |
| Is it OK to allow the user to activate this tag? | |
| static | canAddTagsAccompanyingChange (array $tags, ?Authority $performer=null, $checkBlock=true) |
| 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, ?Authority $performer=null) |
| Is it OK to allow the user to create this tag? | |
| static | canDeactivateTag ( $tag, ?Authority $performer=null) |
| Is it OK to allow the user to deactivate this tag? | |
| static | canDeleteTag ( $tag, ?Authority $performer=null, int $flags=0) |
| Is it OK to allow the user to delete this tag? | |
| static | canUpdateTags (array $tagsToAdd, array $tagsToRemove, ?Authority $performer=null) |
| Is it OK to allow the user to adds and remove the given tags to/from a change? | |
| static | createTagWithChecks (string $tag, string $reason, Authority $performer, bool $ignoreWarnings=false, array $logEntryTags=[]) |
Creates a tag by adding it to change_tag_def table. | |
| static | deactivateTagWithChecks (string $tag, string $reason, Authority $performer, bool $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 (string $tag, string $reason, Authority $performer, bool $ignoreWarnings=false, array $logEntryTags=[]) |
| Deletes a tag, checking whether it is allowed first, and adding a log entry afterwards. | |
| static | formatSummaryRow ( $tags, $unused, ?MessageLocalizer $localizer=null) |
| Creates HTML for the given tags. | |
| static | getChangeTagList (MessageLocalizer $localizer, Language $lang, bool $activeOnly=self::TAG_SET_ACTIVE_ONLY, bool $useAllTags=self::USE_ALL_TAGS, $labelsOnly=false) |
| Get information about change tags for tag filter dropdown menus. | |
| static | getChangeTagListSummary (MessageLocalizer $localizer, Language $lang, bool $activeOnly=self::TAG_SET_ACTIVE_ONLY, bool $useAllTags=self::USE_ALL_TAGS) |
| Get information about change tags, without parsing messages, for tag filter dropdown menus. | |
| static | getDisplayTableName () |
| Get the name of the change_tag table to use for modifyDisplayQuery(). | |
| 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 | getTags (IReadableDatabase $db, $rc_id=null, $rev_id=null, $log_id=null) |
| Return all the tags associated with the given recent change ID, revision ID, and/or log entry ID. | |
| static | getTagsWithData (IReadableDatabase $db, $rc_id=null, $rev_id=null, $log_id=null) |
| Return all the tags associated with the given recent change ID, revision ID, and/or log entry ID, along with any data stored with the tag. | |
| 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='', bool $exclude=false) |
| 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 | showTagEditingUI (Authority $performer) |
| Indicate whether change tag editing UI is relevant. | |
| static | tagDescription ( $tag, MessageLocalizer $context) |
| Get a short description for a tag. | |
| static | tagHelpLink ( $tag, MessageLocalizer $context) |
| Get the tag's help link. | |
| static | tagLongDescriptionMessage ( $tag, MessageLocalizer $context) |
| Get the message object for the tag's long description. | |
| static | tagShortDescriptionMessage ( $tag, MessageLocalizer $context) |
| Get the message object for the tag's short 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 | updateTags ( $tagsToAdd, $tagsToRemove, &$rc_id=null, &$rev_id=null, &$log_id=null, $params=null, ?RecentChange $rc=null, ?UserIdentity $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, string $reason, Authority $performer) |
| 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 | BYPASS_MAX_USAGE_CHECK = 1 |
| Flag for canDeleteTag(). | |
| const | DISPLAY_TABLE_ALIAS = 'changetagdisplay' |
| const | REVERT_TAGS = [ self::TAG_ROLLBACK, self::TAG_UNDO, self::TAG_MANUAL_REVERT ] |
| List of tags which denote a revert of some sort. | |
| const | TAG_BLANK = 'mw-blank' |
| The tagged edit blanks the page (replaces it with the empty string). | |
| const | TAG_CHANGED_REDIRECT_TARGET = 'mw-changed-redirect-target' |
| The tagged edit changes the target of a redirect page. | |
| const | TAG_CONTENT_MODEL_CHANGE = 'mw-contentmodelchange' |
| The tagged edit changes the content model of the page. | |
| const | TAG_IPBLOCK_APPEAL = 'mw-ipblock-appeal' |
| This tagged temporary account auto-creation was performed via Special:Mytalk from an IP address that is blocked from account creation. | |
| const | TAG_MANUAL_REVERT = 'mw-manual-revert' |
| The tagged edit restores the page to an earlier revision. | |
| const | TAG_NEW_REDIRECT = 'mw-new-redirect' |
| The tagged edit creates a new redirect (either by creating a new page or turning an existing page into a redirect). | |
| const | TAG_RECREATE = 'mw-recreated' |
| The tagged edit recreates a page that has been previously deleted. | |
| const | TAG_REMOVED_REDIRECT = 'mw-removed-redirect' |
| The tagged edit turns a redirect page into a non-redirect. | |
| const | TAG_REPLACE = 'mw-replace' |
| The tagged edit removes more than 90% of the content of the page. | |
| const | TAG_REVERTED = 'mw-reverted' |
| The tagged edit is reverted by a subsequent edit (which is tagged by one of TAG_ROLLBACK, TAG_UNDO, TAG_MANUAL_REVERT). | |
| const | TAG_ROLLBACK = 'mw-rollback' |
| The tagged edit is a rollback (undoes the previous edit and all immediately preceding edits by the same user, and was performed via the "rollback" link available to advanced users or via the rollback API). | |
| const | TAG_SERVER_SIDE_UPLOAD = 'mw-server-side-upload' |
| This tagged edit was performed while importing media files using the importImages.php maintenance script. | |
| const | TAG_SET_ACTIVE_ONLY = true |
Constants that can be used to set the activeOnly parameter for calling self::buildCustomTagFilterSelect in order to improve function/parameter legibility. | |
| const | TAG_SET_ALL = false |
| const | TAG_UNDO = 'mw-undo' |
| The tagged edit is was performed via the "undo" link. | |
| const | USE_ALL_TAGS = true |
Constants that can be used to set the useAllTags parameter for calling self::buildCustomTagFilterSelect in order to improve function/parameter legibility. | |
| const | USE_SOFTWARE_TAGS_ONLY = false |
Static Protected Member Functions | |
| static | restrictedTagError ( $msgOne, $msgMulti, $tags) |
| Helper function to generate a fatal status with a 'not-allowed' type error. | |
Recent changes tagging.
Definition at line 50 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 | |
| Authority | $performer | who to check permissions and 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 892 of file ChangeTags.php.
References MediaWiki\ChangeTags\ChangeTags\canActivateTag(), MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Permissions\Authority\getUser().
|
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) |
Definition at line 344 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Build a text box to select a change tag.
The tag set can be customized via the $activeOnly and $useAllTags parameters and defaults to all active tags.
| 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 |
| bool | $activeOnly | Whether to filter for tags that have been used or not |
| bool | $useAllTags | Whether to use all known tags or to only use software defined tags These map to ChangeTagsStore->listDefinedTags and ChangeTagsStore->getCoreDefinedTags respectively |
Definition at line 753 of file ChangeTags.php.
References MediaWiki\Html\element(), MediaWiki\ChangeTags\ChangeTags\getChangeTagList(), MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MainConfigNames\UseTagFilter.
|
static |
Is it OK to allow the user to activate this tag?
| string | $tag | Tag that you are interested in activating |
| Authority | null | $performer | whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
Definition at line 845 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\ChangeTags\ChangeTags\activateTagWithChecks().
|
static |
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.
| string[] | $tags | Tags that you are interested in applying |
| Authority | null | $performer | whose permission you wish to check, or null to check for a generic non-blocked user with the relevant rights |
| bool | $checkBlock | Whether to check the blocked status of $performer |
Definition at line 462 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\ChangeTags\ChangeTags\restrictedTagError().
|
static |
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 |
| Authority | null | $performer | whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
Definition at line 1019 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\ChangeTags\ChangeTags\isTagNameValid().
Referenced by MediaWiki\ChangeTags\ChangeTags\createTagWithChecks().
|
static |
Is it OK to allow the user to deactivate this tag?
| string | $tag | Tag that you are interested in deactivating |
| Authority | null | $performer | whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
Definition at line 920 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\ChangeTags\ChangeTags\deactivateTagWithChecks().
|
static |
Is it OK to allow the user to delete this tag?
| string | $tag | Tag that you are interested in deleting |
| Authority | null | $performer | whose permission you wish to check, or null if you don't care (e.g. maintenance scripts) |
| int | $flags | Use ChangeTags::BYPASS_MAX_USAGE_CHECK to ignore whether there are more uses than we would normally allow to be deleted through the user interface. |
Definition at line 1123 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\ChangeTags\ChangeTags\deleteTagWithChecks().
|
static |
Is it OK to allow the user to adds and remove the given 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.
| string[] | $tagsToAdd | Tags that you are interested in adding |
| string[] | $tagsToRemove | Tags that you are interested in removing |
| Authority | null | $performer | whose permission you wish to check, or null to check for a generic non-blocked user with the relevant rights |
Definition at line 511 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\ChangeTags\ChangeTags\restrictedTagError().
Referenced by MediaWiki\ChangeTags\ChangeTags\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 | |
| Authority | $performer | who to check permissions and 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 1075 of file ChangeTags.php.
References MediaWiki\ChangeTags\ChangeTags\canCreateTag(), MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Permissions\Authority\getUser().
|
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 | |
| Authority | $performer | who to check permissions and 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 958 of file ChangeTags.php.
References MediaWiki\ChangeTags\ChangeTags\canDeactivateTag(), MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Permissions\Authority\getUser().
|
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 831 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
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 1106 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
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 | |
| Authority | $performer | who to check permissions and 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 1187 of file ChangeTags.php.
References MediaWiki\ChangeTags\ChangeTags\canDeleteTag(), MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Permissions\Authority\getUser().
|
static |
Creates HTML for the given tags.
| string | $tags | Comma-separated list of tags |
| null | string | $unused | Unused (formerly: $page) |
| MessageLocalizer | null | $localizer |
Definition at line 192 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\ChangeTags\ChangeTags\listDefinedTags(), and MediaWiki\ChangeTags\ChangeTags\tagDescription().
Referenced by MediaWiki\ChangeTags\ChangeTagsLogItem\getHTML(), and MediaWiki\ChangeTags\ChangeTagsRevisionItem\getHTML().
|
static |
Get information about change tags for tag filter dropdown menus.
This manipulates the label and description of each tag, which are parsed, stripped and (in the case of description) truncated versions of these messages. Message parsing is expensive, so to detect whether the tag list has changed, use getChangeTagListSummary() instead.
| MessageLocalizer | $localizer | |
| Language | $lang | |
| bool | $activeOnly | |
| bool | $useAllTags | |
| bool | $labelsOnly | Do not parse descriptions and omit 'description' in the result |
Definition at line 1403 of file ChangeTags.php.
References MediaWiki\ChangeTags\ChangeTags\getChangeTagListSummary(), MediaWiki\Language\MessageLocalizer\msg(), MediaWiki\Language\Language\truncateForVisual(), and wfEscapeWikiText().
Referenced by MediaWiki\ChangeTags\ChangeTags\buildTagFilterSelector().
|
static |
Get information about change tags, without parsing messages, for tag filter dropdown menus.
By default, this will return explicitly-defined and software-defined tags that are currently active (have hits)
Message contents are the raw values (->plain()), because parsing messages is expensive. Even though we're not parsing messages, building a data structure with the contents of hundreds of i18n messages is still not cheap (see T223260#5370610), so this function caches its output in WANCache for up to 24 hours.
Returns an array of associative arrays with information about each tag:
This data is consumed by the mediawiki.rcfilters.filters.ui module, specifically mw.rcfilters.dm.FilterGroup and mw.rcfilters.dm.FilterItem.
| MessageLocalizer | $localizer | |
| Language | $lang | |
| bool | $activeOnly | |
| bool | $useAllTags |
Definition at line 1328 of file ChangeTags.php.
References MediaWiki\Language\Language\getCode(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\ChangeTags\ChangeTags\tagHelpLink(), MediaWiki\ChangeTags\ChangeTags\tagLongDescriptionMessage(), and MediaWiki\ChangeTags\ChangeTags\tagShortDescriptionMessage().
Referenced by MediaWiki\ChangeTags\ChangeTags\getChangeTagList().
|
static |
Get the name of the change_tag table to use for modifyDisplayQuery().
This also does first-call initialisation of the table in testing mode.
Definition at line 720 of file ChangeTags.php.
References wfDeprecated().
|
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 174 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Return all the tags associated with the given recent change ID, revision ID, and/or log entry ID.
| IReadableDatabase | $db | the database to query |
| int | null | $rc_id | |
| int | null | $rev_id | |
| int | null | $log_id |
Definition at line 423 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Return all the tags associated with the given recent change ID, revision ID, and/or log entry ID, along with any data stored with the tag.
| IReadableDatabase | $db | the database to query |
| int | null | $rc_id | |
| int | null | $rev_id | |
| int | null | $log_id |
Definition at line 405 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Is the tag name valid?
| string | $tag | Tag that you are interested in creating |
Definition at line 984 of file ChangeTags.php.
References NS_MEDIAWIKI.
Referenced by MediaWiki\ChangeTags\ChangeTags\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() and listSoftwareDefinedTags()
Definition at line 1236 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
Referenced by MediaWiki\ChangeTags\ChangeTags\formatSummaryRow().
|
static |
Lists tags explicitly defined in the change_tag_def table of the database.
Tries memcached first.
Definition at line 1250 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Lists those tags which core or extensions report as being "active".
Definition at line 1223 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
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 1265 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Make the tag summary subquery based on the given tables and return it.
| string | array | $tables | Table names, see Database::select |
Definition at line 733 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
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 and $exclude is false, 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 | false | null | $filter_tag | Tag(s) to select on (OR) |
| bool | $exclude | If true, exclude tag(s) from $filter_tag (NOR) |
Definition at line 696 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
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 1276 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and 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 |
| string[] | $tags | Restricted tags (passed as $1 into the message, count of $tags passed as $2) |
Definition at line 438 of file ChangeTags.php.
Referenced by MediaWiki\ChangeTags\ChangeTags\canAddTagsAccompanyingChange(), and MediaWiki\ChangeTags\ChangeTags\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.
| Authority | $performer |
Definition at line 1458 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\Permissions\Authority\isAllowed().
Referenced by MediaWiki\Actions\Pager\HistoryPager\__construct().
|
static |
Get a short description for a tag.
The description combines the label from tagShortDescriptionMessage() with the link from tagHelpLink() (unless the label already contains some links).
| string | $tag | |
| MessageLocalizer | $context |
Definition at line 300 of file ChangeTags.php.
References MediaWiki\ChangeTags\ChangeTags\tagHelpLink(), and MediaWiki\ChangeTags\ChangeTags\tagShortDescriptionMessage().
Referenced by MediaWiki\ChangeTags\ChangeTags\formatSummaryRow().
|
static |
Get the tag's help link.
Checks if message key "mediawiki:tag-$tag-helppage" exists in content language. If it does, and contains a URL or a page title, return a (possibly relative) link URL that points there. Otherwise return null.
| string | $tag | |
| MessageLocalizer | $context |
Definition at line 281 of file ChangeTags.php.
References MediaWiki\Language\MessageLocalizer\msg().
Referenced by MediaWiki\ChangeTags\ChangeTags\getChangeTagListSummary(), and MediaWiki\ChangeTags\ChangeTags\tagDescription().
|
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 325 of file ChangeTags.php.
References MediaWiki\Language\MessageLocalizer\msg().
Referenced by MediaWiki\ChangeTags\ChangeTags\getChangeTagListSummary().
|
static |
Get the message object for the tag's short description.
Checks if message key "mediawiki:tag-$tag" exists. If it does not, returns the tag name in a RawMessage. If the message exists, it is used, 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 252 of file ChangeTags.php.
References MediaWiki\Language\MessageLocalizer\msg(), and MediaWiki\Message\Message\plaintextParam().
Referenced by MediaWiki\ChangeTags\ChangeTags\getChangeTagListSummary(), and MediaWiki\ChangeTags\ChangeTags\tagDescription().
|
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 1289 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
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 |
| UserIdentity | null | $user | Tagging user, in case the tagging is subsequent to the tagged action |
Definition at line 383 of file ChangeTags.php.
References MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
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 ChangeTagsStore->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 [] or null |
| array | null | $tagsToRemove | If none, pass [] 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 | null | $params | Params to put in the ct_params field of table 'change_tag' when adding tags |
| string | $reason | Comment for the log |
| Authority | $performer | who to check permissions and give credit for the action |
Definition at line 586 of file ChangeTags.php.
References MediaWiki\Permissions\Authority\authorizeAction(), MediaWiki\ChangeTags\ChangeTags\canUpdateTags(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\SpecialPage\SpecialPage\getTitleFor(), MediaWiki\Permissions\Authority\getUser(), and MediaWiki\RevisionDelete\RevDelLogList\suggestTarget().
Referenced by MediaWiki\ChangeTags\ChangeTagsLogList\updateChangeTagsOnAll(), and MediaWiki\ChangeTags\ChangeTagsRevisionList\updateChangeTagsOnAll().
| const MediaWiki\ChangeTags\ChangeTags::BYPASS_MAX_USAGE_CHECK = 1 |
Flag for canDeleteTag().
Definition at line 127 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::DISPLAY_TABLE_ALIAS = 'changetagdisplay' |
Definition at line 141 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::REVERT_TAGS = [ self::TAG_ROLLBACK, self::TAG_UNDO, self::TAG_MANUAL_REVERT ] |
List of tags which denote a revert of some sort.
(See also TAG_REVERTED.)
Definition at line 122 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_BLANK = 'mw-blank' |
The tagged edit blanks the page (replaces it with the empty string).
Definition at line 71 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_CHANGED_REDIRECT_TARGET = 'mw-changed-redirect-target' |
The tagged edit changes the target of a redirect page.
Definition at line 67 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_CONTENT_MODEL_CHANGE = 'mw-contentmodelchange' |
The tagged edit changes the content model of the page.
Definition at line 54 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_IPBLOCK_APPEAL = 'mw-ipblock-appeal' |
This tagged temporary account auto-creation was performed via Special:Mytalk from an IP address that is blocked from account creation.
Definition at line 117 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_MANUAL_REVERT = 'mw-manual-revert' |
The tagged edit restores the page to an earlier revision.
The associated tag data is a JSON containing the edit result (see EditResult::jsonSerialize()).
Definition at line 100 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_NEW_REDIRECT = 'mw-new-redirect' |
The tagged edit creates a new redirect (either by creating a new page or turning an existing page into a redirect).
Definition at line 59 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_RECREATE = 'mw-recreated' |
The tagged edit recreates a page that has been previously deleted.
Definition at line 79 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_REMOVED_REDIRECT = 'mw-removed-redirect' |
The tagged edit turns a redirect page into a non-redirect.
Definition at line 63 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_REPLACE = 'mw-replace' |
The tagged edit removes more than 90% of the content of the page.
Definition at line 75 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_REVERTED = 'mw-reverted' |
The tagged edit is reverted by a subsequent edit (which is tagged by one of TAG_ROLLBACK, TAG_UNDO, TAG_MANUAL_REVERT).
Multiple edits might be reverted by the same edit.
The associated tag data is a JSON containing the edit result (see EditResult::jsonSerialize()) with an extra 'revertId' field containing the revision ID of the reverting edit.
Definition at line 108 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_ROLLBACK = 'mw-rollback' |
The tagged edit is a rollback (undoes the previous edit and all immediately preceding edits by the same user, and was performed via the "rollback" link available to advanced users or via the rollback API).
The associated tag data is a JSON containing the edit result (see EditResult::jsonSerialize()).
Definition at line 87 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_SERVER_SIDE_UPLOAD = 'mw-server-side-upload' |
This tagged edit was performed while importing media files using the importImages.php maintenance script.
Definition at line 112 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_SET_ACTIVE_ONLY = true |
Constants that can be used to set the activeOnly parameter for calling self::buildCustomTagFilterSelect in order to improve function/parameter legibility.
If TAG_SET_ACTIVE_ONLY is used then the hit count for each tag will be checked against and only tags with hits will be returned Otherwise if TAG_SET_ALL is used then all tags will be returned regardlesss of if they've ever been used or not
Definition at line 152 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_SET_ALL = false |
Definition at line 153 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::TAG_UNDO = 'mw-undo' |
The tagged edit is was performed via the "undo" link.
(Usually this means that it undoes some previous edit, but the undo workflow includes an edit step so it could be anything.)
The associated tag data is a JSON containing the edit result (see EditResult::jsonSerialize()).
Definition at line 94 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::USE_ALL_TAGS = true |
Constants that can be used to set the useAllTags parameter for calling self::buildCustomTagFilterSelect in order to improve function/parameter legibility.
If USE_ALL_TAGS is used then all on-wiki tags will be returned Otherwise if USE_SOFTWARE_TAGS_ONLY is used then only mediawiki core-defined tags will be returned
Definition at line 163 of file ChangeTags.php.
| const MediaWiki\ChangeTags\ChangeTags::USE_SOFTWARE_TAGS_ONLY = false |
Definition at line 164 of file ChangeTags.php.