Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/192266

Change subject: Fix parameter order for block logs
......................................................................

Fix parameter order for block logs

The new block log params does not known the message number 4. This
number will be added in the BlockLogFormatter as index 3, but php adds
this at the end, therefor this needs a ksort. Moved the existing ksort
up to the one caller to have it just once and allow other log formatter
also to set index, which are lower than the existing one.
Due to the missing 4 the legacy log params returning index 3 and 4,
therefore move them one up to match the new numbers.

Follow-Up: Ibc7fcaa5a952ff90d42a6477da4baa429f3de64b
Change-Id: Ie23be129ee2bd1d2bf753c3b5cba293d64b8e0e8
---
M includes/logging/BlockLogFormatter.php
M includes/logging/LogFormatter.php
2 files changed, 15 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/66/192266/1

diff --git a/includes/logging/BlockLogFormatter.php 
b/includes/logging/BlockLogFormatter.php
index 13d2183..5b8130f 100644
--- a/includes/logging/BlockLogFormatter.php
+++ b/includes/logging/BlockLogFormatter.php
@@ -31,6 +31,15 @@
        protected function getMessageParameters() {
                $params = parent::getMessageParameters();
 
+               // Legacy log params returning the params in index 3 and 4
+               if ( isset( $params[3] ) ) {
+                       if ( isset( $params[4] ) ) {
+                               $params[5] = $params[4];
+                       }
+                       $params[4] = $params[3];
+                       unset( $params[3] );
+               }
+
                $title = $this->entry->getTarget();
                if ( substr( $title->getText(), 0, 1 ) === '#' ) {
                        // autoblock - no user link possible
diff --git a/includes/logging/LogFormatter.php 
b/includes/logging/LogFormatter.php
index b69ccb2..150c2f1 100644
--- a/includes/logging/LogFormatter.php
+++ b/includes/logging/LogFormatter.php
@@ -398,7 +398,12 @@
         */
        protected function getActionMessage() {
                $message = $this->msg( $this->getMessageKey() );
-               $message->params( $this->getMessageParameters() );
+
+               $params = $this->getMessageParameters();
+               // Bad things happens if the numbers are not in correct order
+               ksort( $params );
+
+               $message->params( $params );
 
                return $message;
        }
@@ -485,9 +490,6 @@
                $params[0] = Message::rawParam( $this->getPerformerElement() );
                $params[1] = $this->canView( LogPage::DELETED_USER ) ? 
$entry->getPerformer()->getName() : '';
                $params[2] = Message::rawParam( $this->makePageLink( 
$entry->getTarget() ) );
-
-               // Bad things happens if the numbers are not in correct order
-               ksort( $params );
 
                $this->parsedParameters = $params;
                return $this->parsedParameters;

-- 
To view, visit https://gerrit.wikimedia.org/r/192266
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie23be129ee2bd1d2bf753c3b5cba293d64b8e0e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to