MediaWiki  1.23.12
ChangeTags Class Reference

Static Public Member Functions

static addTags ( $tags, $rc_id=null, $rev_id=null, $log_id=null, $params=null)
 Add tags to a change given its rc_id, rev_id and/or log_id. More...
 
static buildTagFilterSelector ( $selected='', $fullForm=false, Title $title=null)
 Build a text box to select a change tag. More...
 
static formatSummaryRow ( $tags, $page)
 Creates HTML for the given tags. More...
 
static listDefinedTags ()
 Basically lists defined tags which count even if they aren't applied to anything. More...
 
static modifyDisplayQuery (&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag=false)
 Applies all tags-related changes to a query. More...
 
static tagDescription ( $tag)
 Get a short description for a tag. More...
 
static tagUsageStatistics ()
 Returns a map of any tags used on the wiki to number of edits tagged with them, ordered descending by the hitcount. More...
 

Detailed Description

Definition at line 23 of file ChangeTags.php.

Member Function Documentation

◆ addTags()

static ChangeTags::addTags (   $tags,
  $rc_id = null,
  $rev_id = null,
  $log_id = null,
  $params = null 
)
static

Add tags to a change given its rc_id, rev_id and/or log_id.

Parameters
string | array$tagsTags to add to the change
$rc_idint: rc_id of the change to add the tags to
$rev_idint: rev_id of the change to add the tags to
$log_idint: log_id of the change to add the tags to
string$paramsparams to put in the ct_params field of table 'change_tag'
Exceptions
MWException
Returns
bool: false if no changes are made, otherwise true
Exceptions
MWExceptionwhen $rc_id, $rev_id and $log_id are all null

Definition at line 90 of file ChangeTags.php.

References $dbr, $params, array(), as, DB_MASTER, DB_SLAVE, and wfGetDB().

◆ buildTagFilterSelector()

static ChangeTags::buildTagFilterSelector (   $selected = '',
  $fullForm = false,
Title  $title = null 
)
static

Build a text box to select a change tag.

Parameters
string$selectedtag to select by default
$fullFormBoolean:
  • if false, then it returns an array of (label, form).
  • if true, it returns an entire form around the selector.
$titleTitle object to send the form to. Used when, and only when $fullForm is true.
Returns
String or array:
  • if $fullForm is false: Array with
  • if $fullForm is true: String, html fragment

Definition at line 250 of file ChangeTags.php.

References $html, $title, array(), Xml\element(), global, Html\hidden(), Xml\input(), Html\rawElement(), Xml\tags(), text, and wfMessage().

Referenced by SpecialNewpages\form(), SpecialRecentChanges\getExtraOptions(), HistoryAction\onView(), and LogEventsList\showOptions().

◆ formatSummaryRow()

static ChangeTags::formatSummaryRow (   $tags,
  $page 
)
static

Creates HTML for the given tags.

Parameters
string$tagsComma-separated list of tags
string$pageA label for the type of action which is being displayed, for example: 'history', 'contributions' or 'newpages'
Returns
array Array with two items: (html, classes)
  • html: String: HTML for displaying the tags (empty string when param $tags is empty)
  • classes: Array of strings: CSS classes used in the generated html, one class for each tag

Definition at line 34 of file ChangeTags.php.

References $wgLang, array(), as, Sanitizer\escapeClass(), global, Xml\tags(), and wfMessage().

Referenced by SpecialUndelete\diffHeader(), SpecialUndelete\formatRevisionRow(), SpecialNewpages\formatRow(), ContribsPager\formatRow(), HistoryPager\historyLine(), ChangesList\insertTags(), LogEventsList\logLine(), and DifferenceEngine\showDiffPage().

◆ listDefinedTags()

static ChangeTags::listDefinedTags ( )
static

Basically lists defined tags which count even if they aren't applied to anything.

Tags on items in table 'change_tag' which are not (or no longer) in table 'valid_tag' are not included.

Tries memcached first.

Returns
Array of strings: tags

Definition at line 302 of file ChangeTags.php.

References $dbr, $res, $wgMemc, array(), as, DB_SLAVE, global, wfGetDB(), wfMemcKey(), and wfRunHooks().

Referenced by SpecialTags\execute(), ApiQueryTags\execute(), and ApiFeedContributions\getAllowedParams().

◆ modifyDisplayQuery()

static ChangeTags::modifyDisplayQuery ( $tables,
$fields,
$conds,
$join_conds,
$options,
  $filter_tag = false 
)
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.

Parameters
string | array$tablesTable names, see DatabaseBase::select
string | array$fieldsFields used in query, see DatabaseBase::select
string | array$condsconditions used in query, see DatabaseBase::select
$join_condsArray: join conditions, see DatabaseBase::select
array$optionsoptions, see Database::select
bool | string$filter_tagTag to select on
Exceptions
MWExceptionWhen unable to determine appropriate JOIN condition for tagging

Definition at line 202 of file ChangeTags.php.

References $tables, array(), DB_SLAVE, global, and wfGetDB().

Referenced by SpecialRecentChangesLinked\doMainQuery(), SpecialWatchlist\doMainQuery(), SpecialRecentChanges\doMainQuery(), ChangesListSpecialPage\doMainQuery(), LogPager\getQueryInfo(), HistoryPager\getQueryInfo(), NewPagesPager\getQueryInfo(), and PageArchive\listRevisions().

◆ tagDescription()

static ChangeTags::tagDescription (   $tag)
static

Get a short description for a tag.

Parameters
string$tagtag
Returns
String: Short description of the tag from "mediawiki:tag-$tag" if this message exists, html-escaped version of $tag otherwise

Definition at line 71 of file ChangeTags.php.

References wfMessage().

Referenced by ApiQueryTags\doTag(), and SpecialTags\doTagRow().

◆ tagUsageStatistics()

static ChangeTags::tagUsageStatistics ( )
static

Returns a map of any tags used on the wiki to number of edits tagged with them, ordered descending by the hitcount.

Returns
array Array of string => int

Definition at line 335 of file ChangeTags.php.

References $dbr, $out, $res, array(), as, DB_SLAVE, and wfGetDB().

Referenced by SpecialTags\execute().


The documentation for this class was generated from the following file: