Go to the documentation of this file.
56 if ( $handler !==
'' && is_string( $handler ) && class_exists( $handler ) ) {
57 return new $handler(
$entry );
137 if ( $this->linkRenderer !==
null ) {
140 return MediaWikiServices::getInstance()->getLinkRenderer();
152 ? self::FOR_THIS_USER
163 $logRestrictions = $this->context->getConfig()->get(
'LogRestrictions' );
164 $type = $this->entry->getType();
165 return !isset( $logRestrictions[
$type] )
166 || MediaWikiServices::getInstance()
167 ->getPermissionManager()
168 ->userHasRight( $this->context->getUser(), $logRestrictions[
$type] );
177 if ( $this->audience == self::FOR_THIS_USER ) {
179 $this->entry->getDeleted(), $field, $this->context->getUser() ) &&
193 $this->linkFlood = $value;
205 $this->plaintext =
true;
207 $this->plaintext =
false;
220 $comment = $this->entry->getComment();
222 if ( $comment !=
'' ) {
223 if ( $actionComment ==
'' ) {
224 $actionComment = $comment;
226 $actionComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $comment;
230 return $actionComment;
240 $this->plaintext =
true;
241 $this->irctext =
true;
249 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
254 $movesource = $parameters[
'4::target'];
256 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
259 $movesource = $parameters[
'4::target'];
261 ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
263 case 'move-noredirect':
265 case 'move_redir-noredirect':
274 ->rawParams( $target )->inContentLanguage()->escaped();
278 ->rawParams( $target )->inContentLanguage()->escaped();
291 $diffLink = htmlspecialchars(
292 wfMessage(
'patrol-log-diff', $parameters[
'4::curid'] )
293 ->inContentLanguage()->text() );
294 $text =
wfMessage(
'patrol-log-line', $diffLink,
"[[$target]]",
"" )
295 ->inContentLanguage()->text();
305 ->rawParams( $target .
' ' . $parameters[
'4::description'] )->inContentLanguage()->escaped();
308 $text =
wfMessage(
'unprotectedarticle' )
309 ->rawParams( $target )->inContentLanguage()->escaped();
312 $text =
wfMessage(
'modifiedarticleprotection' )
313 ->rawParams( $target .
' ' . $parameters[
'4::description'] )->inContentLanguage()->escaped();
316 $text =
wfMessage(
'movedarticleprotection' )
317 ->rawParams( $target, $parameters[
'4::oldtitle'] )->inContentLanguage()->escaped();
326 $text =
wfMessage(
'newuserlog-create-entry' )
327 ->inContentLanguage()->escaped();
331 $text =
wfMessage(
'newuserlog-create2-entry' )
332 ->rawParams( $target )->inContentLanguage()->escaped();
335 $text =
wfMessage(
'newuserlog-autocreate-entry' )
336 ->inContentLanguage()->escaped();
345 ->rawParams( $target )->inContentLanguage()->escaped();
350 ->rawParams( $target )->inContentLanguage()->escaped();
356 if ( count( $parameters[
'4::oldgroups'] ) ) {
357 $oldgroups = implode(
', ', $parameters[
'4::oldgroups'] );
359 $oldgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
361 if ( count( $parameters[
'5::newgroups'] ) ) {
362 $newgroups = implode(
', ', $parameters[
'5::newgroups'] );
364 $newgroups =
wfMessage(
'rightsnone' )->inContentLanguage()->escaped();
369 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
372 $text =
wfMessage(
'rightslogentry-autopromote' )
373 ->rawParams( $target, $oldgroups, $newgroups )->inContentLanguage()->escaped();
379 $text =
wfMessage(
'pagemerge-logentry' )
380 ->rawParams( $target, $parameters[
'4::dest'], $parameters[
'5::mergepoint'] )
381 ->inContentLanguage()->escaped();
390 $rawDuration = $parameters[0];
391 $rawFlags = $parameters[1] ??
'';
393 $rawDuration = $parameters[
'5::duration'];
394 $rawFlags = $parameters[
'6::flags'];
396 $duration = $contLang->translateBlockExpiry(
403 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
407 ->rawParams( $target )->inContentLanguage()->escaped();
410 $duration = $contLang->translateBlockExpiry(
411 $parameters[
'5::duration'],
418 ->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
426 $text =
wfMessage(
'import-logentry-upload' )
427 ->rawParams( $target )->inContentLanguage()->escaped();
430 $text =
wfMessage(
'import-logentry-interwiki' )
431 ->rawParams( $target )->inContentLanguage()->escaped();
438 if ( is_null( $text ) ) {
442 $this->plaintext =
false;
443 $this->irctext =
false;
457 if ( $element instanceof
Message ) {
458 $element = $this->plaintext ? $element->text() : $element->escaped();
464 $sep = $this->
msg(
'word-separator' );
465 $sep = $this->plaintext ? $sep->text() : $sep->escaped();
494 $type = $this->entry->getType();
495 $subtype = $this->entry->getSubtype();
497 return "logentry-$type-$subtype";
520 $params[$index + 3] = $value;
526 if ( strpos( $key,
':' ) ===
false ) {
529 list( $index,
$type, ) = explode(
':', $key, 3 );
530 if ( ctype_digit( $index ) ) {
539 if ( count( $params ) ) {
540 $max = max( array_keys( $params ) );
542 for ( $i = 3; $i < $max; $i++ ) {
543 if ( !isset( $params[$i] ) ) {
562 if ( isset( $this->parsedParameters ) ) {
575 $this->parsedParameters = $params;
608 switch ( strtolower( trim(
$type ) ) ) {
613 $value = $this->context->getLanguage()->commaList( $value );
616 $value = $this->
msg( $value )->text();
619 $value = $this->
msg( $value )->inContentLanguage()->text();
626 $value = $user->getName();
634 $value = $this->
msg(
'empty-username' )->text();
642 $value =
$title->getPrefixedText();
667 $msg = $this->
msg(
'invalidtitle' )->text();
668 if ( $this->plaintext ) {
671 return Html::element(
'span', [
'class' =>
'mw-invalidtitle' ], $msg );
675 if ( $this->plaintext ) {
676 $link =
'[[' .
$title->getPrefixedText() .
']]';
678 $html = $html !==
null ?
new HtmlArmor( $html ) : $html;
693 $performer = $this->entry->getPerformer();
713 $element = ltrim( $comment );
731 if ( $this->plaintext ) {
732 return $this->
msg( $message )->text();
736 $attribs = [
'class' =>
'history-deleted' ];
747 if ( $this->plaintext ) {
750 $attribs = [
'class' =>
'history-deleted' ];
761 protected function msg( $key, ...$params ) {
762 return $this->context->msg( $key, ...$params );
772 if ( $this->plaintext ) {
780 if ( $this->linkFlood ) {
819 return $this->entry->getParameters();
839 $vals = explode(
':', $key, 3 );
840 if ( count( $vals ) !== 3 ) {
841 if ( $value instanceof __PHP_Incomplete_Class ) {
842 wfLogWarning(
'Log entry of type ' . $this->entry->getFullType() .
843 ' contains unrecoverable extra parameters.' );
846 $logParams[$key] = $value;
870 $value = (bool)$value;
874 if ( ctype_digit( $value ) || is_int( $value ) ) {
875 $value = (int)$value;
877 $value = (float)$value;
884 if ( is_array( $value ) ) {
895 $msg = $this->
msg( $value );
896 if (
$type ===
'msg-content' ) {
897 $msg->inContentLanguage();
900 $value[
"{$name}_key"] = $msg->getKey();
901 if ( $msg->getParams() ) {
902 $value[
"{$name}_params"] = $msg->getParams();
904 $value[
"{$name}_text"] = $msg->text();
922 $value = $user->getName();
931 return [ $name => $value ];
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Marks HTML that shouldn't be escaped.
getId()
Get the user's ID.
getTimestamp()
Get the timestamp when the action was executed.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
getEditCount()
Get the user's edit count.
getParameters()
Get the extra parameters stored for this message.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
isLegacy()
Whether the parameters for this log are stored in new or old format.
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
getTarget()
Get the target page of this action.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
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,...
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
getType()
The main log type.
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
static newFromRow( $row)
Constructs new LogEntry from database result row.
Interface for log entries.
Extends the LogEntry Interface with some basic functionality.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
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...
getFullType()
The full logtype in format maintype/subtype.
static getMain()
Get the RequestContext object associated with the main request.
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
getSubtype()
The log subtype.
Interface for objects which can provide a MediaWiki context on request.
Represents a title within MediaWiki.
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
The Message class provides methods which fulfil two basic services:
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getPerformer()
Get the user who performed this action.
getName()
Get the user name, or the IP of an anonymous user.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.