mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 22:15:26 +00:00
7f554734e6
As explained on phab, and add a script to fix broken entries. Bug: T231131 Change-Id: I95d70acb936b5ca987af8f237d236fe47b663919
37 lines
973 B
PHP
37 lines
973 B
PHP
<?php
|
|
|
|
class AbuseFilterRightsLogFormatter extends LogFormatter {
|
|
|
|
/**
|
|
* This method is identical to the parent, but it's redeclared to give grep a chance
|
|
* to find the messages.
|
|
* @inheritDoc
|
|
*/
|
|
protected function getMessageKey() {
|
|
$subtype = $this->entry->getSubtype();
|
|
// Messages that can be used here:
|
|
// * logentry-rights-blockautopromote
|
|
// * logentry-rights-restoreautopromote
|
|
return "logentry-rights-$subtype";
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected function extractParameters() {
|
|
$ret = [];
|
|
$ret[3] = $this->entry->getTarget()->getText();
|
|
if ( $this->entry->getSubType() === 'blockautopromote' ) {
|
|
$parameters = $this->entry->getParameters();
|
|
$duration = $parameters['7::duration'];
|
|
// @fixme Temporary for back-compat, all entries will have an int here
|
|
if ( is_int( $duration ) ) {
|
|
$ret[4] = $this->context->getLanguage()->formatDuration( $duration );
|
|
} else {
|
|
$ret[4] = $duration;
|
|
}
|
|
}
|
|
return $ret;
|
|
}
|
|
}
|