Go to the documentation of this file.
90 $this->updateRecentChanges = $rc;
91 $this->sendToUDP = ( $udp ==
'UDP' );
106 'log_timestamp' => $dbw->timestamp( $now ),
107 'log_namespace' => $this->target->getNamespace(),
108 'log_title' => $this->target->getDBkey(),
109 'log_page' => $this->target->getArticleID(),
112 $data += MediaWikiServices::getInstance()->getCommentStore()->insert(
118 $dbw->insert(
'logging', $data, __METHOD__ );
119 $newId = $dbw->insertId();
121 # And update recentchanges
122 if ( $this->updateRecentChanges ) {
126 $now, $titleObj, $this->doer, $this->
getRcComment(),
'',
127 $this->type, $this->action, $this->target, $this->comment,
130 } elseif ( $this->sendToUDP ) {
131 # Don't send private logs to UDP
136 # Notify external application via UDP.
137 # We send this to IRC but do not want to add it the RC table.
140 $now, $titleObj, $this->doer, $this->
getRcComment(),
'',
141 $this->type, $this->action, $this->target, $this->comment,
144 $rc->notifyRCFeeds();
158 if ( $this->comment !=
'' ) {
159 if ( $rcComment ==
'' ) {
162 $rcComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() .
178 if ( $this->comment !=
'' ) {
179 if ( $rcComment ==
'' ) {
182 $rcComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() .
216 return in_array(
$type, self::validTypes() );
233 $params = [], $filterWikilinks =
false
237 $key =
"$type/$action";
240 if ( $skin ===
null ) {
241 $langObj = MediaWikiServices::getInstance()->getContentLanguage();
242 $langObjOrNull =
null;
257 ->inLanguage( $langObj )->escaped();
259 array_unshift(
$params, $titleLink );
262 ->inLanguage( $langObj )->escaped();
269 $args = func_get_args();
272 wfDebug(
"LogPage::actionText - unknown action $key" );
287 if ( $filterWikilinks ) {
288 $rv = str_replace(
'[[',
'', $rv );
289 $rv = str_replace(
']]',
'', $rv );
302 return $title->getPrefixedText();
305 $services = MediaWikiServices::getInstance();
306 $linkRenderer = $services->getLinkRenderer();
308 if (
$title->isSpecialPage() ) {
309 [ $name, $par ] = $services->getSpecialPageFactory()->resolveAlias(
$title->getDBkey() );
311 if ( $name ===
'Log' ) {
312 $logPage =
new LogPage( $par );
314 ->rawParams( $linkRenderer->makeLink(
$title, $logPage->getName()->text() ) )
315 ->inLanguage(
$lang )
320 return $linkRenderer->makeLink(
$title );
345 # Trim spaces on user supplied text
353 if ( !is_object(
$doer ) ) {
360 $logEntry->setTarget(
$target );
361 $logEntry->setPerformer(
$doer );
362 $logEntry->setParameters(
$params );
366 $logEntry->setLegacy(
true );
370 $formatter->setContext( $context );
372 $this->
actionText = $formatter->getPlainActionText();
373 $this->ircActionText = $formatter->getIRCActionText();
387 if ( !strlen( $field ) || empty( $values ) ) {
393 foreach ( $values as $value ) {
395 'ls_field' => $field,
396 'ls_value' => $value,
397 'ls_log_id' => $logid
402 $dbw->insert(
'log_search', $data, __METHOD__, [
'IGNORE' ] );
414 return implode(
"\n",
$params );
424 if (
$blob ===
'' ) {
427 return explode(
"\n",
$blob );
478 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.
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.
static getTitleLink(Title $title, ?Language $lang)
__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.
addEntry( $action, $target, $comment, $params, $doer)
Add a log entry.
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,...
static unstub(&$obj)
Unstubs an object, if it is a stub object.
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...