MediaWiki  1.23.12
LogPage Class Reference

Class to simplify the use of log pages. More...

Collaboration diagram for LogPage:

Public Member Functions

 __construct ( $type, $rc=true, $udp='skipUDP')
 Constructor. More...
 
 addEntry ( $action, $target, $comment, $params=array(), $doer=null)
 Add a log entry. More...
 
 addRelations ( $field, $values, $logid)
 Add relations to log_search table. More...
 
 getComment ()
 Get the comment from the last addEntry() call. More...
 
 getDescription ()
 Description of this log type. More...
 
 getName ()
 Name of the log. More...
 
 getRcComment ()
 Get the RC comment from the last addEntry() call. More...
 
 getRcCommentIRC ()
 Get the RC comment from the last addEntry() call for IRC. More...
 
 getRestriction ()
 Returns the right needed to read this log type. More...
 
 isRestricted ()
 Tells if this log is not viewable by all. More...
 

Static Public Member Functions

static actionText ( $type, $action, $title=null, $skin=null, $params=array(), $filterWikilinks=false)
 Generate text for a log entry. More...
 
static extractParams ( $blob)
 Extract a parameter array from a blob. More...
 
static formatBlockFlag ( $flag, $lang)
 Translate a block log flag if possible. More...
 
static formatBlockFlags ( $flags, $lang)
 Convert a comma-delimited list of block log flags into a more readable (and translated) form. More...
 
static isLogType ( $type)
 Is $type a valid log type. More...
 
static logHeader ( $type)
 Get the log header for the given log type. More...
 
static logName ( $type)
 Get the name for the given log type. More...
 
static makeParamBlob ( $params)
 Create a blob from a parameter array. More...
 
static validTypes ()
 Get the list of valid log types. More...
 

Public Attributes

bool $sendToUDP
 
bool $updateRecentChanges
 
const DELETED_ACTION = 1
 
const DELETED_COMMENT = 2
 
const DELETED_RESTRICTED = 8
 
const DELETED_USER = 4
 
const SUPPRESSED_ACTION = 9
 
const SUPPRESSED_USER = 12
 

Protected Member Functions

 saveContent ()
 

Static Protected Member Functions

static getTitleLink ( $type, $lang, $title, &$params)
 

Private Attributes

string $action
 One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir' *. More...
 
string $actionText
 Plaintext version of the message *. More...
 
string $comment
 Comment associated with action *. More...
 
User $doer
 The user doing the action *. More...
 
string $ircActionText
 Plaintext version of the message for IRC *. More...
 
string $params
 Blob made of a parameters array *. More...
 
Title $target
 
string $type
 One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'. More...
 

Detailed Description

Class to simplify the use of log pages.

The logs are now kept in a table which is easier to manage and trim than ever-growing wiki pages.

Definition at line 32 of file LogPage.php.

Constructor & Destructor Documentation

◆ __construct()

LogPage::__construct (   $type,
  $rc = true,
  $udp = 'skipUDP' 
)

Constructor.

Parameters
string$typeOne of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'
bool$rcWhether to update recent changes as well as the logging table
string$udpPass 'UDP' to send to the UDP feed if NOT sent to RC

Definition at line 73 of file LogPage.php.

References $type, and type.

Member Function Documentation

◆ actionText()

static LogPage::actionText (   $type,
  $action,
  $title = null,
  $skin = null,
  $params = array(),
  $filterWikilinks = false 
)
static

Generate text for a log entry.

Only LogFormatter should call this function.

Parameters
string$typelog type
string$actionlog action
Title | null$titleTitle object or null
Skin | null$skinSkin object or null. If null, we want to use the wiki content language, since that will go to the IRC feed.
array$paramsparameters
bool$filterWikilinksWhether to filter wiki links
Returns
string HTML

Definition at line 252 of file LogPage.php.

References $args, $params, $skin, $title, $type, $wgContLang, $wgLang, formatBlockFlags(), getTitleLink(), global, wfDebug(), and wfMessage().

Referenced by addEntry(), and LegacyLogFormatter\getActionMessage().

◆ addEntry()

LogPage::addEntry (   $action,
  $target,
  $comment,
  $params = array(),
  $doer = null 
)

Add a log entry.

Parameters
string$actionone of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'
Title$targetTitle object
string$commentdescription associated
array$paramsparameters passed later to wfMessage function
null | int | User$doerThe user doing the action. null for $wgUser
Returns
int log_id of the inserted log entry

Definition at line 442 of file LogPage.php.

References $action, $comment, $doer, $params, $target, $wgContLang, $wgUser, action, actionText(), array(), global, makeParamBlob(), RequestContext\newExtraneousContext(), LogFormatter\newFromEntry(), User\newFromId(), saveContent(), and type.

◆ addRelations()

LogPage::addRelations (   $field,
  $values,
  $logid 
)

Add relations to log_search table.

Parameters
string$field
array$values
int$logid
Returns
bool

Definition at line 496 of file LogPage.php.

References $value, array(), as, DB_MASTER, and wfGetDB().

◆ extractParams()

static LogPage::extractParams (   $blob)
static

Extract a parameter array from a blob.

Parameters
string$blob
Returns
array

Definition at line 533 of file LogPage.php.

References $blob, and array().

Referenced by PopulateLogSearch\doDBUpdates().

◆ formatBlockFlag()

static LogPage::formatBlockFlag (   $flag,
  $lang 
)
static

Translate a block log flag if possible.

Parameters
int$flagFlag to translate
Language$langLanguage object to use
Returns
string

Definition at line 572 of file LogPage.php.

References $messages, array(), and wfMessage().

Referenced by formatBlockFlags().

◆ formatBlockFlags()

static LogPage::formatBlockFlags (   $flags,
  $lang 
)
static

Convert a comma-delimited list of block log flags into a more readable (and translated) form.

Parameters
string$flagsFlags to format
Language$lang
Returns
string

Definition at line 549 of file LogPage.php.

References $flags, formatBlockFlag(), and wfMessage().

Referenced by actionText().

◆ getComment()

LogPage::getComment ( )

Get the comment from the last addEntry() call.

Definition at line 178 of file LogPage.php.

References $comment.

◆ getDescription()

LogPage::getDescription ( )

Description of this log type.

Returns
Message
Since
1.19

Definition at line 619 of file LogPage.php.

References $type, global, type, and wfMessage().

◆ getName()

LogPage::getName ( )

Name of the log.

Returns
Message
Since
1.19

Definition at line 601 of file LogPage.php.

References $type, global, type, and wfMessage().

◆ getRcComment()

LogPage::getRcComment ( )

Get the RC comment from the last addEntry() call.

Returns
string

Definition at line 140 of file LogPage.php.

References $actionText, $comment, and wfMessage().

Referenced by saveContent().

◆ getRcCommentIRC()

LogPage::getRcCommentIRC ( )

Get the RC comment from the last addEntry() call for IRC.

Returns
string

Definition at line 160 of file LogPage.php.

References $comment, $ircActionText, and wfMessage().

Referenced by saveContent().

◆ getRestriction()

LogPage::getRestriction ( )

Returns the right needed to read this log type.

Returns
string
Since
1.19

Definition at line 636 of file LogPage.php.

References $type, global, and type.

Referenced by isRestricted().

◆ getTitleLink()

static LogPage::getTitleLink (   $type,
  $lang,
  $title,
$params 
)
staticprotected
Todo:
Document
Parameters
string$type
Language | null$lang
Title$title
array$params
Returns
string

Definition at line 357 of file LogPage.php.

References $name, $params, $title, $type, array(), User\idFromName(), Linker\link(), list, Title\newFromText(), SpecialPageFactory\resolveAlias(), Linker\TOOL_LINKS_NOBLOCK, Linker\userLink(), Linker\userToolLinks(), and wfMessage().

Referenced by actionText().

◆ isLogType()

static LogPage::isLogType (   $type)
static

Is $type a valid log type.

Parameters
string$typeLog type to check
Returns
bool

Definition at line 199 of file LogPage.php.

References $type, and validTypes().

Referenced by SpecialLog\execute(), and LogEventsList\showHeader().

◆ isRestricted()

LogPage::isRestricted ( )

Tells if this log is not viewable by all.

Returns
bool
Since
1.19

Definition at line 653 of file LogPage.php.

References getRestriction().

◆ logHeader()

static LogPage::logHeader (   $type)
static

Get the log header for the given log type.

Todo:
handle missing log types
Parameters
string$typelogtype
Returns
string Header text of this logtype
Deprecated:
in 1.19, warnings in 1.21. Use getDescription()

Definition at line 231 of file LogPage.php.

References $type, global, wfDeprecated(), and wfMessage().

◆ logName()

static LogPage::logName (   $type)
static

Get the name for the given log type.

Parameters
string$typeLog type
Returns
string Log name
Deprecated:
in 1.19, warnings in 1.21. Use getName()

Definition at line 210 of file LogPage.php.

References $type, global, text, wfDeprecated(), and wfMessage().

◆ makeParamBlob()

static LogPage::makeParamBlob (   $params)
static

Create a blob from a parameter array.

Parameters
array$params
Returns
string

Definition at line 523 of file LogPage.php.

References $params.

Referenced by addEntry().

◆ saveContent()

LogPage::saveContent ( )
protected
Returns
int log_id of the inserted log entry

Definition at line 82 of file LogPage.php.

References $comment, $params, action, array(), DB_MASTER, getRcComment(), getRcCommentIRC(), SpecialPage\getTitleFor(), global, RecentChange\newLogEntry(), RecentChange\notifyLog(), type, wfGetDB(), and wfTimestampNow().

Referenced by addEntry().

◆ validTypes()

static LogPage::validTypes ( )
static

Get the list of valid log types.

Returns
array of strings

Definition at line 187 of file LogPage.php.

References global.

Referenced by LogEventsList\getTypeSelector(), and isLogType().

Member Data Documentation

◆ $action

string LogPage::$action
private

One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir' *.

Definition at line 55 of file LogPage.php.

Referenced by addEntry().

◆ $actionText

string LogPage::$actionText
private

Plaintext version of the message *.

Definition at line 48 of file LogPage.php.

Referenced by getRcComment().

◆ $comment

string LogPage::$comment
private

Comment associated with action *.

Definition at line 57 of file LogPage.php.

Referenced by addEntry(), getComment(), getRcComment(), getRcCommentIRC(), and saveContent().

◆ $doer

User LogPage::$doer
private

The user doing the action *.

Definition at line 61 of file LogPage.php.

Referenced by addEntry().

◆ $ircActionText

string LogPage::$ircActionText
private

Plaintext version of the message for IRC *.

Definition at line 46 of file LogPage.php.

Referenced by getRcCommentIRC().

◆ $params

string LogPage::$params
private

Blob made of a parameters array *.

Definition at line 59 of file LogPage.php.

Referenced by actionText(), addEntry(), getTitleLink(), makeParamBlob(), and saveContent().

◆ $sendToUDP

bool LogPage::$sendToUDP

Definition at line 44 of file LogPage.php.

◆ $target

Title LogPage::$target
private

Definition at line 63 of file LogPage.php.

Referenced by addEntry().

◆ $type

string LogPage::$type
private

One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'.

Definition at line 52 of file LogPage.php.

Referenced by __construct(), actionText(), getDescription(), getName(), getRestriction(), getTitleLink(), isLogType(), logHeader(), and logName().

◆ $updateRecentChanges

bool LogPage::$updateRecentChanges

Definition at line 42 of file LogPage.php.

◆ DELETED_ACTION

◆ DELETED_COMMENT

◆ DELETED_RESTRICTED

◆ DELETED_USER

◆ SUPPRESSED_ACTION

const LogPage::SUPPRESSED_ACTION = 9

Definition at line 40 of file LogPage.php.

Referenced by LogPager\limitTitle().

◆ SUPPRESSED_USER

const LogPage::SUPPRESSED_USER = 12

Definition at line 39 of file LogPage.php.

Referenced by LogPager\limitPerformer().


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