60 $logActionsHandlers = MediaWikiServices::getInstance()->getMainConfig()
61 ->get( MainConfigNames::LogActionsHandlers );
64 $handler = $logActionsHandlers[$fulltype] ?? $logActionsHandlers[$wildcard] ??
'';
66 if ( $handler !==
'' && is_string( $handler ) && class_exists( $handler ) ) {
67 return new $handler(
$entry );
113 private $linkRenderer;
144 $this->linkRenderer = $linkRenderer;
152 if ( $this->linkRenderer !==
null ) {
153 return $this->linkRenderer;
155 return MediaWikiServices::getInstance()->getLinkRenderer();
167 ? self::FOR_THIS_USER
178 $logRestrictions = $this->context->getConfig()->get( MainConfigNames::LogRestrictions );
179 $type = $this->entry->getType();
180 return !isset( $logRestrictions[
$type] )
181 || $this->context->getAuthority()->isAllowed( $logRestrictions[
$type] );
190 if ( $this->audience == self::FOR_THIS_USER ) {
192 $this->entry->getDeleted(), $field, $this->context->getAuthority() ) &&
206 $this->linkFlood = $value;
218 $this->plaintext =
true;
220 $this->plaintext =
false;
233 $comment = $this->entry->getComment();
235 if ( $comment !=
'' ) {
236 if ( $actionComment ==
'' ) {
237 $actionComment = $comment;
239 $actionComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $comment;
243 return $actionComment;
254 $this->plaintext =
true;
255 $this->irctext =
true;
263 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
268 $movesource = $parameters[
'4::target'];
270 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
273 $movesource = $parameters[
'4::target'];
275 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
277 case 'move-noredirect':
279 case 'move_redir-noredirect':
288 ->rawParams( $target )->inContentLanguage()->escaped();
292 ->rawParams( $target )->inContentLanguage()->escaped();
301 $diffLink = htmlspecialchars(
302 wfMessage(
'patrol-log-diff', $parameters[
'4::curid'] )
303 ->inContentLanguage()->text() );
304 $text =
wfMessage(
'patrol-log-line', $diffLink,
"[[$target]]",
"" )
305 ->inContentLanguage()->text();
315 ->rawParams( $target .
' ' . $parameters[
'4::description'] )
316 ->inContentLanguage()
320 $text =
wfMessage(
'unprotectedarticle' )
321 ->rawParams( $target )->inContentLanguage()->escaped();
324 $text =
wfMessage(
'modifiedarticleprotection' )
325 ->rawParams( $target .
' ' . $parameters[
'4::description'] )
326 ->inContentLanguage()
330 $text =
wfMessage(
'movedarticleprotection' )
331 ->rawParams( $target, $parameters[
'4::oldtitle'] )->inContentLanguage()->escaped();
340 $text =
wfMessage(
'newuserlog-create-entry' )
341 ->inContentLanguage()->escaped();
345 $text =
wfMessage(
'newuserlog-create2-entry' )
346 ->rawParams( $target )->inContentLanguage()->escaped();
349 $text =
wfMessage(
'newuserlog-autocreate-entry' )
350 ->inContentLanguage()->escaped();
359 ->rawParams( $target )->inContentLanguage()->escaped();
364 ->rawParams( $target )->inContentLanguage()->escaped();
370 if ( count( $parameters[
'4::oldgroups'] ) ) {
371 $oldgroups = implode(
', ', $parameters[
'4::oldgroups'] );
373 $oldgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
375 if ( count( $parameters[
'5::newgroups'] ) ) {
376 $newgroups = implode(
', ', $parameters[
'5::newgroups'] );
378 $newgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
383 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
386 $text =
wfMessage(
'rightslogentry-autopromote' )
387 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
393 $text =
wfMessage(
'pagemerge-logentry' )
394 ->rawParams( $target, $parameters[
'4::dest'], $parameters[
'5::mergepoint'] )
395 ->inContentLanguage()->escaped();
404 $rawDuration = $parameters[0];
405 $rawFlags = $parameters[1] ??
'';
407 $rawDuration = $parameters[
'5::duration'];
408 $rawFlags = $parameters[
'6::flags'];
410 $duration = $contLang->translateBlockExpiry(
417 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
421 ->rawParams( $target )->inContentLanguage()->escaped();
424 $duration = $contLang->translateBlockExpiry(
425 $parameters[
'5::duration'],
432 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
440 $text =
wfMessage(
'import-logentry-upload' )
441 ->rawParams( $target )->inContentLanguage()->escaped();
444 $text =
wfMessage(
'import-logentry-interwiki' )
445 ->rawParams( $target )->inContentLanguage()->escaped();
453 $this->plaintext =
false;
454 $this->irctext =
false;
469 if ( $element instanceof
Message ) {
470 $element = $this->plaintext ? $element->text() : $element->escaped();
476 $sep = $this->
msg(
'word-separator' );
477 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
507 $type = $this->entry->getType();
508 $subtype = $this->entry->getSubtype();
510 return "logentry-$type-$subtype";
535 $params[$index + 3] = $value;
541 if ( strpos( $key,
':' ) ===
false ) {
544 [ $index,
$type, ] = explode(
':', $key, 3 );
545 if ( ctype_digit( $index ) ) {
554 if ( count( $params ) ) {
555 $max = max( array_keys( $params ) );
557 for ( $i = 3; $i < $max; $i++ ) {
558 if ( !isset( $params[$i] ) ) {
578 if ( isset( $this->parsedParameters ) ) {
591 $this->parsedParameters = $params;
624 switch ( strtolower( trim(
$type ) ) ) {
629 $value = $this->context->getLanguage()->commaList( $value );
632 $value = $this->
msg( $value )->text();
635 $value = $this->
msg( $value )->inContentLanguage()->text();
642 $value = $user->getName();
650 $value = $this->
msg(
'empty-username' )->text();
657 $title = Title::newFromText( $value );
658 $value =
$title->getPrefixedText();
661 $title = Title::newFromText( $value );
685 $msg = $this->
msg(
'invalidtitle' )->text();
686 if ( $this->plaintext ) {
689 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ], $msg );
693 if ( $this->plaintext ) {
694 $link =
'[[' .
$title->getPrefixedText() .
']]';
696 $html = $html !==
null ?
new HtmlArmor( $html ) : $html;
711 $performerIdentity = $this->entry->getPerformerIdentity();
730 $comment = MediaWikiServices::getInstance()->getCommentFormatter()
731 ->formatBlock( $this->entry->getComment() );
733 $element = ltrim( $comment );
751 if ( $this->plaintext ) {
752 return $this->
msg( $message )->text();
764 if ( $this->plaintext ) {
767 $attribs = [
'class' => [
'history-deleted' ] ];
769 $attribs[
'class'][] =
'mw-history-suppressed';
772 return Html::rawElement(
'span', $attribs,
$content );
781 protected function msg( $key, ...$params ) {
782 return $this->context->msg( $key, ...$params );
792 if ( $this->plaintext ) {
795 $element = Linker::userLink(
799 if ( $this->linkFlood ) {
801 ? MediaWikiServices::getInstance()->getUserEditTracker()->getUserEditCount( $user )
804 $element .= Linker::userToolLinks(
844 return $this->entry->getParameters();
865 $vals = explode(
':', $key, 3 );
866 if ( count( $vals ) !== 3 ) {
867 if ( $value instanceof __PHP_Incomplete_Class ) {
868 wfLogWarning(
'Log entry of type ' . $this->entry->getFullType() .
869 ' contains unrecoverable extra parameters.' );
872 $logParams[$key] = $value;
896 $value = (bool)$value;
900 if ( is_int( $value ) || ctype_digit( (
string)$value ) ) {
901 $value = (int)$value;
903 $value = (float)$value;
910 if ( is_array( $value ) ) {
921 $msg = $this->
msg( $value );
922 if (
$type ===
'msg-content' ) {
923 $msg->inContentLanguage();
926 $value[
"{$name}_key"] = $msg->getKey();
927 if ( $msg->getParams() ) {
928 $value[
"{$name}_params"] = $msg->getParams();
930 $value[
"{$name}_text"] = $msg->text();
935 $title = Title::newFromText( $value );
947 $value = $user->getName();
956 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.
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,...
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.