MediaWiki  master
Go to the documentation of this file.
1 <?php
45  private $comment = null;
54  private $revert = null;
56  public function getComment() {
57  if ( $this->comment === null ) {
58  $this->comment = parent::getComment();
59  }
61  // Make sure we execute the LogLine hook so that we immediately return
62  // the correct value.
63  if ( $this->revert === null ) {
64  $this->getActionLinks();
65  }
67  return $this->comment;
68  }
74  protected function getActionMessage() {
76  $action = LogPage::actionText(
77  $entry->getType(),
78  $entry->getSubtype(),
79  $entry->getTarget(),
80  $this->plaintext ? null : $this->context->getSkin(),
82  !$this->plaintext // whether to filter [[]] links
83  );
85  $performer = $this->getPerformerElement();
86  if ( !$this->irctext ) {
87  $sep = $this->msg( 'word-separator' );
88  $sep = $this->plaintext ? $sep->text() : $sep->escaped();
89  $action = $performer . $sep . $action;
90  }
92  return $action;
93  }
95  public function getActionLinks() {
96  if ( $this->revert !== null ) {
97  return $this->revert;
98  }
100  if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) ) {
101  $this->revert = '';
102  return $this->revert;
103  }
105  $title = $this->entry->getTarget();
106  $type = $this->entry->getType();
107  $subtype = $this->entry->getSubtype();
109  // Do nothing. The implementation is handled by the hook modifiying the
110  // passed-by-ref parameters. This also changes the default value so that
111  // getComment() and getActionLinks() do not call them indefinitely.
112  $this->revert = '';
114  // This is to populate the $comment member of this instance so that it
115  // can be modified when calling the hook just below.
116  if ( $this->comment === null ) {
117  $this->getComment();
118  }
120  $params = $this->entry->getParameters();
122  Hooks::run( 'LogLine', [ $type, $subtype, $title, $params,
123  &$this->comment, &$this->revert, $this->entry->getTimestamp() ] );
125  return $this->revert;
126  }
127 }
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("", 2))
LogEntryBase $entry
string null $revert
Cache for the result of getActionLinks() so that it does not need to run multiple times depending on ...
The log subtype.
static actionText( $type, $action, $title=null, $skin=null, $params=[], $filterWikilinks=false)
Generate text for a log entry.
Definition: LogPage.php:227
The main log type.
This class formats all log entries for log types which have not been converted to the new system...
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:780
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
string null $comment
Backward compatibility for extension changing the comment from the LogLine hook.
Implements the default log formatting.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
Get the extra parameters stored for this message.
Provides the name of the user who performed the log action.
msg( $key)
Shortcut for wfMessage which honors local context.
Get the target page of this action.
Definition: LogPage.php:34
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200