Fix malformed output of block logs
authorThalia <thalia.e.chan@googlemail.com>
Wed, 9 Jan 2019 16:09:37 +0000 (16:09 +0000)
committerThalia <thalia.e.chan@googlemail.com>
Wed, 9 Jan 2019 16:16:53 +0000 (16:16 +0000)
Avoid adding <span> to expiry parameter whenever block log is
stored as plaintext.

Bug: T208523
Change-Id: Id3fcdfda7311484911ae1f57ec262a2c6e6ab00b

includes/logging/BlockLogFormatter.php

index 2698cbe..6bc3f39 100644 (file)
@@ -57,15 +57,20 @@ class BlockLogFormatter extends LogFormatter {
                        // The lrm is needed to make sure that the number
                        // is shown on the correct side of the tooltip text.
                        $durationTooltip = '&lrm;' . htmlspecialchars( $params[4] );
-                       $params[4] = Message::rawParam(
-                               "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
-                               $this->context->getLanguage()->translateBlockExpiry(
-                                       $params[4],
-                                       $this->context->getUser(),
-                                       wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
-                               ) .
-                               '</span>'
+                       $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
+                               $params[4],
+                               $this->context->getUser(),
+                               wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
                        );
+                       if ( $this->plaintext ) {
+                               $params[4] = Message::rawParam( $blockExpiry );
+                       } else {
+                               $params[4] = Message::rawParam(
+                                       "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
+                                       $blockExpiry .
+                                       '</span>'
+                               );
+                       }
                        $params[5] = isset( $params[5] ) ?
                                self::formatBlockFlags( $params[5], $this->context->getLanguage() ) : '';