Fixes for r96546 (bug 33167):
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 8 Feb 2012 19:52:04 +0000 (19:52 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 8 Feb 2012 19:52:04 +0000 (19:52 +0000)
* Made LegacyLogFormatter try to respect the 'plaintext' parameter.
* Changed LogPage::addEntry() to use LogFormatter to get the action text as such calls to LogPage::actionText() are broken.
* Added comment to LogPage::actionText(). It's only OK to call this from the legacy log formatter, fetched via the proper factory functions.
* Converted CheckUser to using LogFormatter so that cuc_actiontext values work. Eventually, cuc_actiontext should be replaced with new cuc_params, cuc_log_type, and cuc_log_action fields, similar to the RC table.

includes/logging/LogFormatter.php
includes/logging/LogPage.php

index 7c8645f..322a250 100644 (file)
@@ -393,9 +393,9 @@ class LegacyLogFormatter extends LogFormatter {
                        $entry->getType(),
                        $entry->getSubtype(),
                        $entry->getTarget(),
-                       $this->context->getSkin(),
+                       $this->plaintext ? null : $this->context->getSkin(),
                        (array)$entry->getParameters(),
-                       true
+                       !$this->plaintext // whether to filter [[]] links
                );
 
                $performer = $this->getPerformerElement();
index f4dd064..bbb4de8 100644 (file)
@@ -201,7 +201,8 @@ class LogPage {
        }
 
        /**
-        * Generate text for a log entry
+        * Generate text for a log entry. 
+        * Only LogFormatter should call this function.
         *
         * @param $type String: log type
         * @param $action String: log action
@@ -420,6 +421,7 @@ class LogPage {
         * @param $doer User object: the user doing the action
         *
         * @return bool|int|null
+        * @TODO: make this use LogEntry::saveContent()
         */
        public function addEntry( $action, $target, $comment, $params = array(), $doer = null ) {
                global $wgContLang;
@@ -449,7 +451,16 @@ class LogPage {
 
                $this->doer = $doer;
 
-               $this->actionText = LogPage::actionText( $this->type, $action, $target, null, $params );
+               $logEntry = new ManualLogEntry( $this->type, $action );
+               $logEntry->setTarget( $target );
+               $logEntry->setPerformer( $doer );
+               $logEntry->setParameters( $params );
+
+               $formatter = LogFormatter::newFromEntry( $logEntry );
+               $context = RequestContext::newExtraneousContext( $target );
+               $formatter->setContext( $context );
+
+               $this->actionText = $formatter->getPlainActionText();
 
                return $this->saveContent();
        }