/** @var int ID of the log entry */
protected $id;
+ /** @var bool Whether this is a legacy log entry */
+ protected $legacy = false;
+
/**
* Constructor.
*
$this->comment = $comment;
}
+ /**
+ * Set the 'legacy' flag
+ *
+ * @since 1.25
+ * @param bool $legacy
+ */
+ public function setLegacy( $legacy ) {
+ $this->legacy = $legacy;
+ }
+
/**
* TODO: document
*
return $this->comment;
}
+ /**
+ * @since 1.25
+ * @return bool
+ */
+ public function isLegacy() {
+ return $this->legacy;
+ }
+
public function getDeleted() {
return (int)$this->deleted;
}
switch ( $entry->getSubtype() ) {
case 'block':
global $wgContLang;
- $duration = $wgContLang->translateBlockExpiry( $parameters['5::duration'] );
- $flags = BlockLogFormatter::formatBlockFlags( $parameters['6::flags'], $wgContLang );
+ // Keep compatibility with extensions by checking for
+ // new key (5::duration/6::flags) or old key (0/optional 1)
+ if ( $entry->isLegacy() ) {
+ $rawDuration = $parameters[0];
+ $rawFlags = isset( $parameters[1] ) ? $parameters[1] : '';
+ } else {
+ $rawDuration = $parameters['5::duration'];
+ $rawFlags = $parameters['6::flags'];
+ }
+ $duration = $wgContLang->translateBlockExpiry( $rawDuration );
+ $flags = BlockLogFormatter::formatBlockFlags( $rawFlags, $wgContLang );
$text = wfMessage( 'blocklogentry' )
->rawParams( $target, $duration, $flags )->inContentLanguage()->escaped();
break;
$logEntry->setTarget( $target );
$logEntry->setPerformer( $doer );
$logEntry->setParameters( $params );
+ // All log entries using the LogPage to insert into the logging table
+ // are using the old logging system and therefore the legacy flag is
+ // needed to say the LogFormatter the parameters have numeric keys
+ $logEntry->setLegacy( true );
$formatter = LogFormatter::newFromEntry( $logEntry );
$context = RequestContext::newExtraneousContext( $target );