MediaWiki  master
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, $performer)
 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=[], $filterWikilinks=false)
 Generate text for a log entry. More...
 
static extractParams ( $blob)
 Extract a parameter array from a blob. More...
 
static isLogType ( $type)
 Is $type a valid 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 = self::DELETED_ACTION | self::DELETED_RESTRICTED
 
const SUPPRESSED_USER = self::DELETED_USER | self::DELETED_RESTRICTED
 

Protected Member Functions

 saveContent ()
 

Static Private Member Functions

static getTitleLink (Title $title, ?Language $lang)
 

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...
 
string $ircActionText
 Plaintext version of the message for IRC. More...
 
string $params
 Blob made of a parameters array. More...
 
UserIdentity $performer
 The user doing the action. 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.

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

Constructor & Destructor Documentation

◆ __construct()

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

References $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$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 236 of file LogPage.php.

References $args, $params, $title, $wgLang, getTitleLink(), StubObject\unstub(), wfDebug(), and wfMessage().

Referenced by LegacyLogFormatter\getActionMessage().

◆ addEntry()

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

References RequestContext\newExtraneousContext(), LogFormatter\newFromEntry(), and User\newFromId().

◆ addRelations()

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

Add relations to log_search table.

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

Definition at line 391 of file LogPage.php.

References DB_PRIMARY, and wfGetDB().

◆ extractParams()

static LogPage::extractParams (   $blob)
static

Extract a parameter array from a blob.

Parameters
string$blob
Returns
array

Definition at line 428 of file LogPage.php.

References $blob.

Referenced by DatabaseLogEntry\getParameters().

◆ getComment()

LogPage::getComment ( )

Get the comment from the last addEntry() call.

Returns
string

Definition at line 198 of file LogPage.php.

References $comment.

◆ getDescription()

LogPage::getDescription ( )

Description of this log type.

Returns
Message
Since
1.19

Definition at line 455 of file LogPage.php.

References $type, and wfMessage().

◆ getName()

LogPage::getName ( )

Name of the log.

Returns
Message
Since
1.19

Definition at line 441 of file LogPage.php.

References $type, and wfMessage().

◆ getRcComment()

LogPage::getRcComment ( )

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

Returns
string

Definition at line 159 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 179 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 468 of file LogPage.php.

References $type.

◆ getTitleLink()

static LogPage::getTitleLink ( Title  $title,
?Language  $lang 
)
staticprivate
Parameters
Title$title
?Language$lang
Returns
string HTML

Definition at line 304 of file LogPage.php.

References $title.

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

◆ makeParamBlob()

static LogPage::makeParamBlob (   $params)
static

Create a blob from a parameter array.

Parameters
array$params
Returns
string

Definition at line 418 of file LogPage.php.

◆ saveContent()

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

Definition at line 99 of file LogPage.php.

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

◆ validTypes()

static LogPage::validTypes ( )
static

Member Data Documentation

◆ $action

string LogPage::$action
private

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

Definition at line 69 of file LogPage.php.

Referenced by saveContent().

◆ $actionText

string LogPage::$actionText
private

Plaintext version of the message.

Definition at line 59 of file LogPage.php.

Referenced by getRcComment().

◆ $comment

string LogPage::$comment
private

Comment associated with action.

Definition at line 72 of file LogPage.php.

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

◆ $ircActionText

string LogPage::$ircActionText
private

Plaintext version of the message for IRC.

Definition at line 56 of file LogPage.php.

Referenced by getRcCommentIRC().

◆ $params

string LogPage::$params
private

Blob made of a parameters array.

Definition at line 75 of file LogPage.php.

Referenced by actionText(), and saveContent().

◆ $performer

UserIdentity LogPage::$performer
private

The user doing the action.

Definition at line 78 of file LogPage.php.

◆ $sendToUDP

bool LogPage::$sendToUDP

Definition at line 53 of file LogPage.php.

◆ $target

Title LogPage::$target
private

Definition at line 81 of file LogPage.php.

◆ $type

string LogPage::$type
private

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

Definition at line 64 of file LogPage.php.

Referenced by __construct(), isLogType(), and saveContent().

◆ $updateRecentChanges

bool LogPage::$updateRecentChanges

Definition at line 50 of file LogPage.php.

◆ DELETED_ACTION

◆ DELETED_COMMENT

◆ DELETED_RESTRICTED

◆ DELETED_USER

◆ SUPPRESSED_ACTION

const LogPage::SUPPRESSED_ACTION = self::DELETED_ACTION | self::DELETED_RESTRICTED

◆ SUPPRESSED_USER

const LogPage::SUPPRESSED_USER = self::DELETED_USER | self::DELETED_RESTRICTED

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