MediaWiki  REL1_22
ChangeTags Class Reference

List of all members.

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

Detailed Description

Definition at line 23 of file ChangeTags.php.


Member Function Documentation

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 93 of file ChangeTags.php.

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

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 227 of file ChangeTags.php.

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

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

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 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 37 of file ChangeTags.php.

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

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 258 of file ChangeTags.php.

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

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

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 177 of file ChangeTags.php.

References $options, array(), and global.

Referenced by SpecialRecentchangeslinked\doMainQuery(), SpecialRecentChanges\doMainQuery(), SpecialWatchlist\execute(), LogPager\getQueryInfo(), and HistoryPager\getQueryInfo().

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 74 of file ChangeTags.php.

References wfMessage().

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

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 291 of file ChangeTags.php.

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

Referenced by SpecialTags\execute().


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