Go to the documentation of this file.
85 $this->updateRecentChanges = $rc;
86 $this->sendToUDP = ( $udp ==
'UDP' );
101 'log_timestamp' => $dbw->timestamp( $now ),
102 'log_namespace' => $this->target->getNamespace(),
103 'log_title' => $this->target->getDBkey(),
104 'log_page' => $this->target->getArticleID(),
107 $data += MediaWikiServices::getInstance()->getCommentStore()->insert(
113 $dbw->insert(
'logging', $data, __METHOD__ );
114 $newId = $dbw->insertId();
116 # And update recentchanges
117 if ( $this->updateRecentChanges ) {
121 $now, $titleObj, $this->doer, $this->
getRcComment(),
'',
122 $this->type, $this->action, $this->target, $this->comment,
125 } elseif ( $this->sendToUDP ) {
126 # Don't send private logs to UDP
131 # Notify external application via UDP.
132 # We send this to IRC but do not want to add it the RC table.
135 $now, $titleObj, $this->doer, $this->
getRcComment(),
'',
136 $this->type, $this->action, $this->target, $this->comment,
139 $rc->notifyRCFeeds();
153 if ( $this->comment !=
'' ) {
154 if ( $rcComment ==
'' ) {
157 $rcComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() .
173 if ( $this->comment !=
'' ) {
174 if ( $rcComment ==
'' ) {
177 $rcComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() .
211 return in_array(
$type, self::validTypes() );
228 $params = [], $filterWikilinks =
false
232 if ( is_null( $skin ) ) {
233 $langObj = MediaWikiServices::getInstance()->getContentLanguage();
234 $langObjOrNull =
null;
240 $key =
"$type/$action";
243 if ( is_null(
$title ) ) {
250 ->inLanguage( $langObj )->escaped();
252 array_unshift(
$params, $titleLink );
255 ->inLanguage( $langObj )->escaped();
262 $args = func_get_args();
265 wfDebug(
"LogPage::actionText - unknown action $key\n" );
280 if ( $filterWikilinks ) {
281 $rv = str_replace(
'[[',
'', $rv );
282 $rv = str_replace(
']]',
'', $rv );
298 return $title->getPrefixedText();
301 $services = MediaWikiServices::getInstance();
302 $linkRenderer = $services->getLinkRenderer();
303 if (
$title->isSpecialPage() ) {
304 list( $name, $par ) = $services->getSpecialPageFactory()->
305 resolveAlias(
$title->getDBkey() );
307 # Use the language name for log titles, rather than Log/X
308 if ( $name ==
'Log' ) {
309 $logPage =
new LogPage( $par );
310 $titleLink = $linkRenderer->makeLink(
$title, $logPage->getName()->text() );
312 ->inLanguage(
$lang )
313 ->rawParams( $titleLink )
316 $titleLink = $linkRenderer->makeLink(
$title );
319 $titleLink = $linkRenderer->makeLink(
$title );
346 # Trim spaces on user supplied text
354 if (
$doer ===
null ) {
357 } elseif ( !is_object(
$doer ) ) {
364 $logEntry->setTarget(
$target );
365 $logEntry->setPerformer(
$doer );
366 $logEntry->setParameters(
$params );
370 $logEntry->setLegacy(
true );
376 $this->
actionText = $formatter->getPlainActionText();
377 $this->ircActionText = $formatter->getIRCActionText();
391 if ( !strlen( $field ) || empty( $values ) ) {
397 foreach ( $values as $value ) {
399 'ls_field' => $field,
400 'ls_value' => $value,
401 'ls_log_id' => $logid
406 $dbw->insert(
'log_search', $data, __METHOD__, [
'IGNORE' ] );
418 return implode(
"\n",
$params );
428 if (
$blob ===
'' ) {
431 return explode(
"\n",
$blob );
481 return $restriction !==
'' && $restriction !==
'*';
static newFromId( $id)
Static factory method for creation from a given user ID.
static validTypes()
Get the list of valid log types.
static getTitleLink( $type, $lang, $title, &$params)
if(!isset( $args[0])) $lang
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type.
static extractParams( $blob)
Extract a parameter array from a blob.
isRestricted()
Tells if this log is not viewable by all.
static notifyLog( $timestamp, $title, $user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
string $params
Blob made of a parameters array.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
$wgLogActions
Lists the message key string for formatting individual events of each type and action when listed in ...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
static actionText( $type, $action, $title=null, $skin=null, $params=[], $filterWikilinks=false)
Generate text for a log entry.
static newMigration()
Static constructor.
__construct( $type, $rc=true, $udp='skipUDP')
getRestriction()
Returns the right needed to read this log type.
getComment()
Get the comment from the last addEntry() call.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
static isLogType( $type)
Is $type a valid log type.
getDescription()
Description of this log type.
Class to simplify the use of log pages.
getName()
Name of the log.
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
getRcCommentIRC()
Get the RC comment from the last addEntry() call for IRC.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
string $action
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'.
string $comment
Comment associated with action.
static makeParamBlob( $params)
Create a blob from a parameter array.
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
User $doer
The user doing the action.
getRcComment()
Get the RC comment from the last addEntry() call.
string $type
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'.
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
addRelations( $field, $values, $logid)
Add relations to log_search table.
string $ircActionText
Plaintext version of the message for IRC.
static newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='', $revId=0, $isPatrollable=false)
Represents a title within MediaWiki.
string $actionText
Plaintext version of the message.
Class for creating new log entries and inserting them into the database.
$wgLogNames
Lists the message key string for each log type.
bool $updateRecentChanges
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
addEntry( $action, $target, $comment, $params=[], $doer=null)
Add a log entry.