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(
112 $data += ActorMigration::newMigration()->getInsertValues( $dbw,
'log_user', $this->doer );
113 $dbw->insert(
'logging', $data, __METHOD__ );
114 $newId = $dbw->insertId();
116 # And update recentchanges
117 if ( $this->updateRecentChanges ) {
118 $titleObj = SpecialPage::getTitleFor(
'Log', $this->type );
120 RecentChange::notifyLog(
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.
133 $titleObj = SpecialPage::getTitleFor(
'Log', $this->type );
134 $rc = RecentChange::newLogEntry(
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 !==
'*';
$wgLogActions
Lists the message key string for formatting individual events of each type and action when listed in ...
$wgLogNames
Lists the message key string for each log type.
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type.
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Class to simplify the use of log pages.
static actionText( $type, $action, $title=null, $skin=null, $params=[], $filterWikilinks=false)
Generate text for a log entry.
getRestriction()
Returns the right needed to read this log type.
__construct( $type, $rc=true, $udp='skipUDP')
static makeParamBlob( $params)
Create a blob from a parameter array.
string $comment
Comment associated with action.
string $ircActionText
Plaintext version of the message for IRC.
User $doer
The user doing the action.
string $action
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move', 'move_redir'.
isRestricted()
Tells if this log is not viewable by all.
static extractParams( $blob)
Extract a parameter array from a blob.
static isLogType( $type)
Is $type a valid log type.
static getTitleLink( $type, $lang, $title, &$params)
getName()
Name of the log.
string $actionText
Plaintext version of the message.
addEntry( $action, $target, $comment, $params=[], $doer=null)
Add a log entry.
getComment()
Get the comment from the last addEntry() call.
bool $updateRecentChanges
getRcComment()
Get the RC comment from the last addEntry() call.
string $type
One of '', 'block', 'protect', 'rights', 'delete', 'upload', 'move'.
addRelations( $field, $values, $logid)
Add relations to log_search table.
static validTypes()
Get the list of valid log types.
getRcCommentIRC()
Get the RC comment from the last addEntry() call for IRC.
string $params
Blob made of a parameters array.
getDescription()
Description of this log type.
Class for creating new log entries and inserting them into the database.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
if(!isset( $args[0])) $lang