56 if ( $handler !==
'' && is_string( $handler ) && class_exists( $handler ) ) {
57 return new $handler(
$entry );
113 $this->context = RequestContext::getMain();
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();
625 $user = User::newFromName( $value );
626 $value = $user->getName();
631 $user = User::newFromName( $value );
634 $value = $this->
msg(
'empty-username' )->text();
641 $title = Title::newFromText( $value );
642 $value =
$title->getPrefixedText();
645 $title = Title::newFromText( $value );
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' ];
738 return Html::rawElement(
'span', $attribs,
$content );
747 if ( $this->plaintext ) {
750 $attribs = [
'class' =>
'history-deleted' ];
752 return Html::rawElement(
'span', $attribs,
$content );
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;
851 ApiResult::setIndexedTagName( $logParams,
'param' );
852 ApiResult::setArrayType( $logParams,
'assoc' );
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 ) ) {
885 ApiResult::setArrayType( $value,
$type );
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();
909 $title = Title::newFromText( $value );
912 $title = SpecialPage::getTitleFor(
'Badtitle', $value );
915 ApiQueryBase::addTitleInfo( $value,
$title,
"{$name}_" );
920 $user = User::newFromName( $value );
922 $value = $user->getName();
931 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.
static newFromRow( $row)
Constructs new LogEntry from database result row.
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.
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
The Message class provides methods which fulfil two basic services:
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.