MediaWiki master
MediaWiki\Logging\LogPage Class Reference

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

Public Member Functions

 __construct ( $type, $rc=true, $udp='skipUDP')
 
 addEntry ( $action, $target, $comment, $params, $performer)
 Add a log entry.
 
 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 = self::DELETED_ACTION | self::DELETED_RESTRICTED
 
const SUPPRESSED_USER = self::DELETED_USER | self::DELETED_RESTRICTED
 

Protected Member Functions

 saveContent ()
 

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.

Stability: newable
Note
marked as newable in 1.35 for lack of a better alternative, but should become a stateless service, use the command pattern.

Definition at line 50 of file LogPage.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Logging\LogPage::__construct ( $type,
$rc = true,
$udp = 'skipUDP' )
Stability: stable
to call
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 101 of file LogPage.php.

Member Function Documentation

◆ actionText()

static MediaWiki\Logging\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$title
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$params
bool$filterWikilinksWhether to filter wiki links
Returns
string HTML

Definition at line 250 of file LogPage.php.

References $wgLang, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\MainConfigNames\LogActions, wfDebug(), and wfMessage().

Referenced by MediaWiki\Logging\LegacyLogFormatter\getActionMessage().

◆ addEntry()

MediaWiki\Logging\LogPage::addEntry ( $action,
$target,
$comment,
$params,
$performer )

Add a log entry.

Parameters
string$actionOne of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'
Title$target
string | null$commentDescription associated
array$paramsParameters passed later to wfMessage function
int | UserIdentity$performerThe user doing the action, or their user id. Calling with user ID is deprecated since 1.36.
Returns
int The log_id of the inserted log entry

Definition at line 351 of file LogPage.php.

References MediaWiki\MediaWikiServices\getInstance().

◆ extractParams()

static MediaWiki\Logging\LogPage::extractParams ( $blob)
static

Extract a parameter array from a blob.

Parameters
string$blob
Returns
array

Definition at line 406 of file LogPage.php.

Referenced by MediaWiki\Logging\DatabaseLogEntry\getParameters().

◆ getComment()

MediaWiki\Logging\LogPage::getComment ( )

Get the comment from the last addEntry() call.

Returns
string

Definition at line 212 of file LogPage.php.

◆ getDescription()

MediaWiki\Logging\LogPage::getDescription ( )

Description of this log type.

Returns
Message
Since
1.19

Definition at line 433 of file LogPage.php.

References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\MainConfigNames\LogHeaders, and wfMessage().

◆ getName()

MediaWiki\Logging\LogPage::getName ( )

Name of the log.

Returns
Message
Since
1.19

Definition at line 419 of file LogPage.php.

References MediaWiki\MediaWikiServices\getInstance(), MediaWiki\MainConfigNames\LogNames, and wfMessage().

◆ getRcComment()

MediaWiki\Logging\LogPage::getRcComment ( )

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

Returns
string

Definition at line 173 of file LogPage.php.

References wfMessage().

Referenced by MediaWiki\Logging\LogPage\saveContent().

◆ getRcCommentIRC()

MediaWiki\Logging\LogPage::getRcCommentIRC ( )

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

Returns
string

Definition at line 193 of file LogPage.php.

References wfMessage().

Referenced by MediaWiki\Logging\LogPage\saveContent().

◆ getRestriction()

MediaWiki\Logging\LogPage::getRestriction ( )

Returns the right needed to read this log type.

Returns
string
Since
1.19

Definition at line 446 of file LogPage.php.

References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MainConfigNames\LogRestrictions.

◆ isLogType()

static MediaWiki\Logging\LogPage::isLogType ( $type)
static

Is $type a valid log type.

Parameters
string$typeLog type to check
Returns
bool

Definition at line 233 of file LogPage.php.

◆ isRestricted()

MediaWiki\Logging\LogPage::isRestricted ( )

Tells if this log is not viewable by all.

Returns
bool
Since
1.19

Definition at line 458 of file LogPage.php.

◆ makeParamBlob()

static MediaWiki\Logging\LogPage::makeParamBlob ( $params)
static

Create a blob from a parameter array.

Parameters
array$params
Returns
string

Definition at line 396 of file LogPage.php.

◆ saveContent()

◆ validTypes()

static MediaWiki\Logging\LogPage::validTypes ( )
static

Get the list of valid log types.

Returns
string[]

Definition at line 221 of file LogPage.php.

References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MainConfigNames\LogTypes.

Member Data Documentation

◆ $sendToUDP

bool MediaWiki\Logging\LogPage::$sendToUDP

Definition at line 64 of file LogPage.php.

◆ $updateRecentChanges

bool MediaWiki\Logging\LogPage::$updateRecentChanges

Definition at line 61 of file LogPage.php.

◆ DELETED_ACTION

◆ DELETED_COMMENT

const MediaWiki\Logging\LogPage::DELETED_COMMENT = 2

Definition at line 52 of file LogPage.php.

◆ DELETED_RESTRICTED

const MediaWiki\Logging\LogPage::DELETED_RESTRICTED = 8

Definition at line 54 of file LogPage.php.

Referenced by MediaWiki\Logging\LogEventsList\userCanBitfield().

◆ DELETED_USER

const MediaWiki\Logging\LogPage::DELETED_USER = 4

Definition at line 53 of file LogPage.php.

◆ SUPPRESSED_ACTION

const MediaWiki\Logging\LogPage::SUPPRESSED_ACTION = self::DELETED_ACTION | self::DELETED_RESTRICTED

Definition at line 58 of file LogPage.php.

◆ SUPPRESSED_USER

const MediaWiki\Logging\LogPage::SUPPRESSED_USER = self::DELETED_USER | self::DELETED_RESTRICTED

Definition at line 57 of file LogPage.php.


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