58 if ( $handler !==
'' && is_string( $handler ) && class_exists( $handler ) ) {
59 return new $handler(
$entry );
120 $this->context = RequestContext::getMain();
144 if ( $this->linkRenderer !==
null ) {
147 return MediaWikiServices::getInstance()->getLinkRenderer();
159 ? self::FOR_THIS_USER
170 $logRestrictions = $this->context->getConfig()->get(
'LogRestrictions' );
171 $type = $this->entry->getType();
172 return !isset( $logRestrictions[
$type] )
173 || MediaWikiServices::getInstance()
174 ->getPermissionManager()
175 ->userHasRight( $this->context->getUser(), $logRestrictions[
$type] );
184 if ( $this->audience == self::FOR_THIS_USER ) {
185 return LogEventsList::userCanBitfield(
186 $this->entry->getDeleted(), $field, $this->context->getUser() ) &&
200 $this->linkFlood = $value;
212 $this->plaintext =
true;
214 $this->plaintext =
false;
227 $comment = $this->entry->getComment();
229 if ( $comment !=
'' ) {
230 if ( $actionComment ==
'' ) {
231 $actionComment = $comment;
233 $actionComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $comment;
237 return $actionComment;
247 $this->plaintext =
true;
248 $this->irctext =
true;
256 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
261 $movesource = $parameters[
'4::target'];
263 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
266 $movesource = $parameters[
'4::target'];
268 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
270 case 'move-noredirect':
272 case 'move_redir-noredirect':
281 ->rawParams( $target )->inContentLanguage()->escaped();
285 ->rawParams( $target )->inContentLanguage()->escaped();
294 $diffLink = htmlspecialchars(
295 wfMessage(
'patrol-log-diff', $parameters[
'4::curid'] )
296 ->inContentLanguage()->text() );
297 $text =
wfMessage(
'patrol-log-line', $diffLink,
"[[$target]]",
"" )
298 ->inContentLanguage()->text();
308 ->rawParams( $target .
' ' . $parameters[
'4::description'] )
309 ->inContentLanguage()
313 $text =
wfMessage(
'unprotectedarticle' )
314 ->rawParams( $target )->inContentLanguage()->escaped();
317 $text =
wfMessage(
'modifiedarticleprotection' )
318 ->rawParams( $target .
' ' . $parameters[
'4::description'] )
319 ->inContentLanguage()
323 $text =
wfMessage(
'movedarticleprotection' )
324 ->rawParams( $target, $parameters[
'4::oldtitle'] )->inContentLanguage()->escaped();
333 $text =
wfMessage(
'newuserlog-create-entry' )
334 ->inContentLanguage()->escaped();
338 $text =
wfMessage(
'newuserlog-create2-entry' )
339 ->rawParams( $target )->inContentLanguage()->escaped();
342 $text =
wfMessage(
'newuserlog-autocreate-entry' )
343 ->inContentLanguage()->escaped();
352 ->rawParams( $target )->inContentLanguage()->escaped();
357 ->rawParams( $target )->inContentLanguage()->escaped();
363 if ( count( $parameters[
'4::oldgroups'] ) ) {
364 $oldgroups = implode(
', ', $parameters[
'4::oldgroups'] );
366 $oldgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
368 if ( count( $parameters[
'5::newgroups'] ) ) {
369 $newgroups = implode(
', ', $parameters[
'5::newgroups'] );
371 $newgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
376 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
379 $text =
wfMessage(
'rightslogentry-autopromote' )
380 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
386 $text =
wfMessage(
'pagemerge-logentry' )
387 ->rawParams( $target, $parameters[
'4::dest'], $parameters[
'5::mergepoint'] )
388 ->inContentLanguage()->escaped();
397 $rawDuration = $parameters[0];
398 $rawFlags = $parameters[1] ??
'';
400 $rawDuration = $parameters[
'5::duration'];
401 $rawFlags = $parameters[
'6::flags'];
403 $duration = $contLang->translateBlockExpiry(
410 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
414 ->rawParams( $target )->inContentLanguage()->escaped();
417 $duration = $contLang->translateBlockExpiry(
418 $parameters[
'5::duration'],
425 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
433 $text =
wfMessage(
'import-logentry-upload' )
434 ->rawParams( $target )->inContentLanguage()->escaped();
437 $text =
wfMessage(
'import-logentry-interwiki' )
438 ->rawParams( $target )->inContentLanguage()->escaped();
445 if ( $text ===
null ) {
449 $this->plaintext =
false;
450 $this->irctext =
false;
465 if ( $element instanceof
Message ) {
466 $element = $this->plaintext ? $element->text() : $element->escaped();
472 $sep = $this->
msg(
'word-separator' );
473 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
503 $type = $this->entry->getType();
504 $subtype = $this->entry->getSubtype();
506 return "logentry-$type-$subtype";
531 $params[$index + 3] = $value;
537 if ( strpos( $key,
':' ) ===
false ) {
540 list( $index,
$type, ) = explode(
':', $key, 3 );
541 if ( ctype_digit( $index ) ) {
550 if ( count( $params ) ) {
551 $max = max( array_keys( $params ) );
553 for ( $i = 3; $i < $max; $i++ ) {
554 if ( !isset( $params[$i] ) ) {
574 if ( isset( $this->parsedParameters ) ) {
587 $this->parsedParameters = $params;
620 switch ( strtolower( trim(
$type ) ) ) {
625 $value = $this->context->getLanguage()->commaList( $value );
628 $value = $this->
msg( $value )->text();
631 $value = $this->
msg( $value )->inContentLanguage()->text();
637 $user = User::newFromName( $value );
638 $value = $user->getName();
643 $user = User::newFromName( $value );
646 $value = $this->
msg(
'empty-username' )->text();
653 $title = Title::newFromText( $value );
654 $value =
$title->getPrefixedText();
657 $title = Title::newFromText( $value );
680 $msg = $this->
msg(
'invalidtitle' )->text();
681 if ( $this->plaintext ) {
684 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ], $msg );
688 if ( $this->plaintext ) {
689 $link =
'[[' .
$title->getPrefixedText() .
']]';
691 $html = $html !==
null ?
new HtmlArmor( $html ) : $html;
706 $performer = $this->entry->getPerformer();
727 $element = ltrim( $comment );
745 if ( $this->plaintext ) {
746 return $this->
msg( $message )->text();
750 $attribs = [
'class' =>
'history-deleted' ];
752 return Html::rawElement(
'span', $attribs,
$content );
761 if ( $this->plaintext ) {
764 $attribs = [
'class' =>
'history-deleted' ];
766 return Html::rawElement(
'span', $attribs,
$content );
775 protected function msg( $key, ...$params ) {
776 return $this->context->msg( $key, ...$params );
786 if ( $this->plaintext ) {
794 if ( $this->linkFlood ) {
835 return $this->entry->getParameters();
856 $vals = explode(
':', $key, 3 );
857 if ( count( $vals ) !== 3 ) {
858 if ( $value instanceof __PHP_Incomplete_Class ) {
859 wfLogWarning(
'Log entry of type ' . $this->entry->getFullType() .
860 ' contains unrecoverable extra parameters.' );
863 $logParams[$key] = $value;
868 ApiResult::setIndexedTagName( $logParams,
'param' );
869 ApiResult::setArrayType( $logParams,
'assoc' );
887 $value = (bool)$value;
891 if ( is_int( $value ) || ctype_digit( (
string)$value ) ) {
892 $value = (int)$value;
894 $value = (float)$value;
901 if ( is_array( $value ) ) {
902 ApiResult::setArrayType( $value,
$type );
912 $msg = $this->
msg( $value );
913 if (
$type ===
'msg-content' ) {
914 $msg->inContentLanguage();
917 $value[
"{$name}_key"] = $msg->getKey();
918 if ( $msg->getParams() ) {
919 $value[
"{$name}_params"] = $msg->getParams();
921 $value[
"{$name}_text"] = $msg->text();
926 $title = Title::newFromText( $value );
932 ApiQueryBase::addTitleInfo( $value,
$title,
"{$name}_" );
937 $user = User::newFromName( $value );
939 $value = $user->getName();
948 return [ $name => $value ];
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
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.
Marks HTML that shouldn't be escaped.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static commentBlock( $comment, $title=null, $local=false, $wikiId=null, $useParentheses=true)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
Extends the LogEntry Interface with some basic functionality.
isLegacy()
Whether the parameters for this log are stored in new or old format.
getFullType()
The full logtype in format maintype/subtype.
The Message class deals with fetching and processing of interface message into a variety of formats.
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.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getName()
Get the user name, or the IP of an anonymous user.
getId()
Get the user's ID.
getEditCount()
Get the user's edit count.
Interface for objects which can provide a MediaWiki context on request.
Interface for log entries.
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.
getPerformer()
Get the user who performed this action.
getType()
The main log type.