58 $logActionsHandlers = MediaWikiServices::getInstance()->getMainConfig()
59 ->get( MainConfigNames::LogActionsHandlers );
62 $handler = $logActionsHandlers[$fulltype] ?? $logActionsHandlers[$wildcard] ??
'';
64 if ( $handler !==
'' && is_string( $handler ) && class_exists( $handler ) ) {
65 return new $handler(
$entry );
111 private $linkRenderer;
142 $this->linkRenderer = $linkRenderer;
150 if ( $this->linkRenderer !==
null ) {
151 return $this->linkRenderer;
153 return MediaWikiServices::getInstance()->getLinkRenderer();
165 ? self::FOR_THIS_USER
176 $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
177 $type = $this->entry->getType();
178 return !isset( $logRestrictions[
$type] )
179 || $this->context->getAuthority()->isAllowed( $logRestrictions[
$type] );
188 if ( $this->audience == self::FOR_THIS_USER ) {
190 $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
204 $this->linkFlood = $value;
216 $this->plaintext =
true;
218 $this->plaintext =
false;
231 $comment = $this->entry->getComment();
233 if ( $comment !=
'' ) {
234 if ( $actionComment ==
'' ) {
235 $actionComment = $comment;
237 $actionComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $comment;
241 return $actionComment;
252 $this->plaintext =
true;
253 $this->irctext =
true;
261 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
266 $movesource = $parameters[
'4::target'];
268 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
271 $movesource = $parameters[
'4::target'];
273 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
275 case 'move-noredirect':
277 case 'move_redir-noredirect':
286 ->rawParams( $target )->inContentLanguage()->escaped();
290 ->rawParams( $target )->inContentLanguage()->escaped();
299 $diffLink = htmlspecialchars(
300 wfMessage(
'patrol-log-diff', $parameters[
'4::curid'] )
301 ->inContentLanguage()->text() );
302 $text =
wfMessage(
'patrol-log-line', $diffLink,
"[[$target]]",
"" )
303 ->inContentLanguage()->text();
313 ->rawParams( $target .
' ' . $parameters[
'4::description'] )
314 ->inContentLanguage()
318 $text =
wfMessage(
'unprotectedarticle' )
319 ->rawParams( $target )->inContentLanguage()->escaped();
322 $text =
wfMessage(
'modifiedarticleprotection' )
323 ->rawParams( $target .
' ' . $parameters[
'4::description'] )
324 ->inContentLanguage()
328 $text =
wfMessage(
'movedarticleprotection' )
329 ->rawParams( $target, $parameters[
'4::oldtitle'] )->inContentLanguage()->escaped();
338 $text =
wfMessage(
'newuserlog-create-entry' )
339 ->inContentLanguage()->escaped();
343 $text =
wfMessage(
'newuserlog-create2-entry' )
344 ->rawParams( $target )->inContentLanguage()->escaped();
347 $text =
wfMessage(
'newuserlog-autocreate-entry' )
348 ->inContentLanguage()->escaped();
357 ->rawParams( $target )->inContentLanguage()->escaped();
362 ->rawParams( $target )->inContentLanguage()->escaped();
368 if ( count( $parameters[
'4::oldgroups'] ) ) {
369 $oldgroups = implode(
', ', $parameters[
'4::oldgroups'] );
371 $oldgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
373 if ( count( $parameters[
'5::newgroups'] ) ) {
374 $newgroups = implode(
', ', $parameters[
'5::newgroups'] );
376 $newgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
381 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
384 $text =
wfMessage(
'rightslogentry-autopromote' )
385 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
391 $text =
wfMessage(
'pagemerge-logentry' )
392 ->rawParams( $target, $parameters[
'4::dest'], $parameters[
'5::mergepoint'] )
393 ->inContentLanguage()->escaped();
402 $rawDuration = $parameters[0];
403 $rawFlags = $parameters[1] ??
'';
405 $rawDuration = $parameters[
'5::duration'];
406 $rawFlags = $parameters[
'6::flags'];
408 $duration = $contLang->translateBlockExpiry(
415 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
419 ->rawParams( $target )->inContentLanguage()->escaped();
422 $duration = $contLang->translateBlockExpiry(
423 $parameters[
'5::duration'],
430 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
438 $text =
wfMessage(
'import-logentry-upload' )
439 ->rawParams( $target )->inContentLanguage()->escaped();
442 $text =
wfMessage(
'import-logentry-interwiki' )
443 ->rawParams( $target )->inContentLanguage()->escaped();
451 $this->plaintext =
false;
452 $this->irctext =
false;
467 if ( $element instanceof
Message ) {
468 $element = $this->plaintext ? $element->text() : $element->escaped();
474 $sep = $this->
msg(
'word-separator' );
475 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
505 $type = $this->entry->getType();
506 $subtype = $this->entry->getSubtype();
508 return "logentry-$type-$subtype";
533 $params[$index + 3] = $value;
539 if ( strpos( $key,
':' ) ===
false ) {
542 [ $index,
$type, ] = explode(
':', $key, 3 );
543 if ( ctype_digit( $index ) ) {
552 if ( count( $params ) ) {
553 $max = max( array_keys( $params ) );
555 for ( $i = 3; $i < $max; $i++ ) {
556 if ( !isset( $params[$i] ) ) {
576 if ( isset( $this->parsedParameters ) ) {
589 $this->parsedParameters = $params;
622 switch ( strtolower( trim(
$type ) ) ) {
627 $value = $this->context->getLanguage()->commaList( $value );
630 $value = $this->
msg( $value )->text();
633 $value = $this->
msg( $value )->inContentLanguage()->text();
640 $value = $user->getName();
648 $value = $this->
msg(
'empty-username' )->text();
656 $value =
$title->getPrefixedText();
683 $msg = $this->
msg(
'invalidtitle' )->text();
684 if ( $this->plaintext ) {
687 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ], $msg );
691 if ( $this->plaintext ) {
692 $link =
'[[' .
$title->getPrefixedText() .
']]';
694 $html = $html !==
null ?
new HtmlArmor( $html ) : $html;
709 $performerIdentity = $this->entry->getPerformerIdentity();
728 $comment = MediaWikiServices::getInstance()->getCommentFormatter()
729 ->formatBlock( $this->entry->getComment() );
731 $element = ltrim( $comment );
749 if ( $this->plaintext ) {
750 return $this->
msg( $message )->text();
754 $attribs = [
'class' =>
'history-deleted' ];
765 if ( $this->plaintext ) {
768 $attribs = [
'class' =>
'history-deleted' ];
779 protected function msg( $key, ...$params ) {
780 return $this->context->msg( $key, ...$params );
790 if ( $this->plaintext ) {
793 $element = Linker::userLink(
797 if ( $this->linkFlood ) {
799 ? MediaWikiServices::getInstance()->getUserEditTracker()->getUserEditCount( $user )
802 $element .= Linker::userToolLinks(
842 return $this->entry->getParameters();
863 $vals = explode(
':', $key, 3 );
864 if ( count( $vals ) !== 3 ) {
865 if ( $value instanceof __PHP_Incomplete_Class ) {
866 wfLogWarning(
'Log entry of type ' . $this->entry->getFullType() .
867 ' contains unrecoverable extra parameters.' );
870 $logParams[$key] = $value;
894 $value = (bool)$value;
898 if ( is_int( $value ) || ctype_digit( (
string)$value ) ) {
899 $value = (int)$value;
901 $value = (float)$value;
908 if ( is_array( $value ) ) {
919 $msg = $this->
msg( $value );
920 if (
$type ===
'msg-content' ) {
921 $msg->inContentLanguage();
924 $value[
"{$name}_key"] = $msg->getKey();
925 if ( $msg->getParams() ) {
926 $value[
"{$name}_params"] = $msg->getParams();
928 $value[
"{$name}_text"] = $msg->text();
945 $value = $user->getName();
954 return [ $name => $value ];
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static newFromRow( $row)
Constructs new LogEntry from database result row.
Marks HTML that shouldn't be escaped.
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
isLegacy()
Whether the parameters for this log are stored in new or old format.
getFullType()
The full logtype in format maintype/subtype.
static userCanBitfield( $bitfield, $field, Authority $performer)
Determine if the current user is allowed to view a particular field of this log row,...
A class containing constants representing the names of configuration variables.
The Message class deals with fetching and processing of interface message into a variety of formats.
static getMain()
Get the RequestContext object associated with the main request.
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,...
Represents a title within MediaWiki.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static newFromName( $name, $validate='valid')
Interface for objects which can provide a MediaWiki context on request.
getParameters()
Get the extra parameters stored for this message.
getTimestamp()
Get the timestamp when the action was executed.
getTarget()
Get the target page of this action.
getSubtype()
The log subtype.
getType()
The main log type.