MediaWiki REL1_31
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')
 
 addEntry ( $action, $target, $comment, $params=[], $doer=null)
 Add a log entry.
 
 addRelations ( $field, $values, $logid)
 Add relations to log_search table.
 
 getComment ()
 Get the comment from the last addEntry() call.
 
 getDescription ()
 Description of this log type.
 
 getName ()
 Name of the log.
 
 getRcComment ()
 Get the RC comment from the last addEntry() call.
 
 getRcCommentIRC ()
 Get the RC comment from the last addEntry() call for IRC.
 
 getRestriction ()
 Returns the right needed to read this log type.
 
 isRestricted ()
 Tells if this log is not viewable by all.
 

Static Public Member Functions

static actionText ( $type, $action, $title=null, $skin=null, $params=[], $filterWikilinks=false)
 Generate text for a log entry.
 
static extractParams ( $blob)
 Extract a parameter array from a blob.
 
static isLogType ( $type)
 Is $type a valid log type.
 
static makeParamBlob ( $params)
 Create a blob from a parameter array.
 
static validTypes ()
 Get the list of valid log types.
 

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'.
 
string $actionText
 Plaintext version of the message.
 
string $comment
 Comment associated with action.
 
User $doer
 The user doing the action.
 
string $ircActionText
 Plaintext version of the message for IRC.
 
string $params
 Blob made of a parameters array.
 
Title $target
 
string $type
 One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'.
 

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 31 of file LogPage.php.

Constructor & Destructor Documentation

◆ __construct()

LogPage::__construct ( $type,
$rc = true,
$udp = 'skipUDP' )
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 80 of file LogPage.php.

References $type, and type.

Member Function Documentation

◆ actionText()

static LogPage::actionText ( $type,
$action,
$title = null,
$skin = null,
$params = [],
$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 221 of file LogPage.php.

References $args, $params, $type, $wgContLang, $wgLang, $wgLogActions, $wgLogActionsHandlers, getTitleLink(), wfDebug(), and wfMessage().

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

◆ addEntry()

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

Add a log entry.

Parameters
string$actionOne of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'
Title$target
string$commentDescription associated
array$paramsParameters passed later to wfMessage function
null | int | User$doerThe user doing the action. null for $wgUser
Returns
int The log_id of the inserted log entry

Definition at line 328 of file LogPage.php.

References $action, $comment, $context, $doer, $params, $target, $wgUser, actionText(), 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 381 of file LogPage.php.

References $value, 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 418 of file LogPage.php.

References $blob.

Referenced by PopulateLogSearch\doDBUpdates(), and DatabaseLogEntry\getParameters().

◆ getComment()

LogPage::getComment ( )

Get the comment from the last addEntry() call.

Returns
string

Definition at line 183 of file LogPage.php.

References $comment.

◆ getDescription()

LogPage::getDescription ( )

Description of this log type.

Returns
Message
Since
1.19

Definition at line 449 of file LogPage.php.

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

◆ getName()

LogPage::getName ( )

Name of the log.

Returns
Message
Since
1.19

Definition at line 431 of file LogPage.php.

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

◆ getRcComment()

LogPage::getRcComment ( )

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

Returns
string

Definition at line 144 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 164 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 466 of file LogPage.php.

References $type, $wgLogRestrictions, 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 290 of file LogPage.php.

References $lang, Linker\link(), list, SpecialPageFactory\resolveAlias(), 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 204 of file LogPage.php.

References $type.

Referenced by SpecialLog\execute().

◆ isRestricted()

LogPage::isRestricted ( )

Tells if this log is not viewable by all.

Returns
bool
Since
1.19

Definition at line 483 of file LogPage.php.

References getRestriction().

◆ makeParamBlob()

static LogPage::makeParamBlob ( $params)
static

Create a blob from a parameter array.

Parameters
array$params
Returns
string

Definition at line 408 of file LogPage.php.

References $params.

Referenced by addEntry(), and LogFormatterTestCase\expandDatabaseRow().

◆ saveContent()

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

Definition at line 89 of file LogPage.php.

References $action, $params, $type, $wgLogRestrictions, DB_MASTER, getRcComment(), getRcCommentIRC(), type, wfGetDB(), and wfTimestampNow().

Referenced by addEntry().

◆ validTypes()

static LogPage::validTypes ( )
static

Get the list of valid log types.

Returns
array Array of strings

Definition at line 192 of file LogPage.php.

References $wgLogTypes.

Referenced by LogEventsList\getTypeSelector().

Member Data Documentation

◆ $action

string LogPage::$action
private

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

Definition at line 60 of file LogPage.php.

Referenced by addEntry(), and saveContent().

◆ $actionText

string LogPage::$actionText
private

Plaintext version of the message.

Definition at line 51 of file LogPage.php.

Referenced by getRcComment().

◆ $comment

string LogPage::$comment
private

Comment associated with action.

Definition at line 63 of file LogPage.php.

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

◆ $doer

User LogPage::$doer
private

The user doing the action.

Definition at line 69 of file LogPage.php.

Referenced by addEntry().

◆ $ircActionText

string LogPage::$ircActionText
private

Plaintext version of the message for IRC.

Definition at line 48 of file LogPage.php.

Referenced by getRcCommentIRC().

◆ $params

string LogPage::$params
private

Blob made of a parameters array.

Definition at line 66 of file LogPage.php.

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

◆ $sendToUDP

bool LogPage::$sendToUDP

Definition at line 45 of file LogPage.php.

◆ $target

Title LogPage::$target
private

Definition at line 72 of file LogPage.php.

Referenced by addEntry().

◆ $type

string LogPage::$type
private

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

Definition at line 56 of file LogPage.php.

Referenced by __construct(), actionText(), getDescription(), getName(), getRestriction(), isLogType(), and saveContent().

◆ $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

◆ SUPPRESSED_USER

const LogPage::SUPPRESSED_USER = 12

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