summaryrefslogtreecommitdiff
path: root/includes/logging/ContentModelLogFormatter.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/logging/ContentModelLogFormatter.php')
-rw-r--r--includes/logging/ContentModelLogFormatter.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/includes/logging/ContentModelLogFormatter.php b/includes/logging/ContentModelLogFormatter.php
new file mode 100644
index 00000000..982fcc30
--- /dev/null
+++ b/includes/logging/ContentModelLogFormatter.php
@@ -0,0 +1,34 @@
+<?php
+
+class ContentModelLogFormatter extends LogFormatter {
+ protected function getMessageParameters() {
+ $lang = $this->context->getLanguage();
+ $params = parent::getMessageParameters();
+ $params[3] = ContentHandler::getLocalizedName( $params[3], $lang );
+ $params[4] = ContentHandler::getLocalizedName( $params[4], $lang );
+ return $params;
+ }
+
+ public function getActionLinks() {
+ if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
+ || $this->entry->getSubtype() !== 'change'
+ || !$this->context->getUser()->isAllowed( 'editcontentmodel' )
+ ) {
+ return '';
+ }
+
+ $params = $this->extractParameters();
+ $revert = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'ChangeContentModel' ),
+ $this->msg( 'logentry-contentmodel-change-revertlink' )->escaped(),
+ array(),
+ array(
+ 'pagetitle' => $this->entry->getTarget()->getPrefixedText(),
+ 'model' => $params[3],
+ 'reason' => $this->msg( 'logentry-contentmodel-change-revert' )->inContentLanguage()->text(),
+ )
+ );
+
+ return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
+ }
+}