From b9e092fa4bfece804ef1f444a98fe7f045dfca1f Mon Sep 17 00:00:00 2001 From: Siebrand Date: Mon, 10 Dec 2012 01:24:21 +0000 Subject: [PATCH] Revert "(bug 24620) Add types to LogFormatter" This breaks extensions because of changing protected methods to public (LogFormatter::getMessageParameters() in particular). We need a solid solution. The next 1.21-wmf is being branched tomorrow. Revert is the sanest solution at the moment. This reverts commit 1c296faf58fe57328c97fff36a57b64c9b8fada7 --- RELEASE-NOTES-1.21 | 1 - includes/logging/LogFormatter.php | 74 +------------------------------ 2 files changed, 1 insertion(+), 74 deletions(-) diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 9ff57b6b68..87a0058f15 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -60,7 +60,6 @@ production. * Debug message emitted by wfDebugLog() will now be prefixed with the group name when its logged to the default log file. That is the case whenever the group has no key in wgDebugLogGroups, that will help triage the default log. -* (bug 24620) Add types to LogFormatter === Bug fixes in 1.21 === * (bug 40353) SpecialDoubleRedirect should support interwiki redirects. diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index f049126503..8c1e294b3e 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -403,7 +403,7 @@ class LogFormatter { foreach ( $entry->getParameters() as $key => $value ) { if ( strpos( $key, ':' ) === false ) continue; list( $index, $type, $name ) = explode( ':', $key, 3 ); - $params[$index - 1] = $this->formatParameterValue( $type, $value ); + $params[$index - 1] = $value; } /* Message class doesn't like non consecutive numbering. @@ -446,78 +446,6 @@ class LogFormatter { return $this->parsedParameters = $params; } - /** - * Formats parameters values dependent to their type - * @param $type string The type of the value. - * Valid are currently: - * * - (empty) or plain: The value is returned as-is - * * raw: The value will be added to the log message - * as raw parameter (e.g. no escaping) - * Use this only if there is no other working - * type like user-link or title-link - * * msg: The value is a message-key, the output is - * the message in user language - * * msg-content: The value is a message-key, the output - * is the message in content language - * * user: The value is a user name, e.g. for GENDER - * * user-link: The value is a user name, returns a - * link for the user - * * title: The value is a page title, - * returns name of page - * * title-link: The value is a page title, - * returns link to this page - * * number: Format value as number - * @param $value string The parameter value that should - * be formated - * @return string or Message::numParam or Message::rawParam - * Formated value - * @since 1.21 - */ - protected function formatParameterValue( $type, $value ) { - $saveLinkFlood = $this->linkFlood; - - switch( strtolower( trim( $type ) ) ) { - case 'raw': - $value = Message::rawParam( $value ); - break; - case 'msg': - $value = $this->msg( $value )->text(); - break; - case 'msg-content': - $value = $this->msg( $value )->inContentLanguage()->text(); - break; - case 'number': - $value = Message::numParam( $value ); - break; - case 'user': - $user = User::newFromName( $value ); - $value = $user->getName(); - break; - case 'user-link': - $this->setShowUserToolLinks( false ); - - $user = User::newFromName( $value ); - $value = Message::rawParam( $this->makeUserLink( $user ) ); - - $this->setShowUserToolLinks( $saveLinkFlood ); - break; - case 'title': - $title = Title::newFromText( $value ); - $value = $title->getPrefixedText(); - break; - case 'title-link': - $title = Title::newFromText( $value ); - $value = Message::rawParam( $this->makePageLink( $title ) ); - break; - case 'plain': - // Plain text, nothing to do - default: - // Catch other types and use the old behavior (return as-is) - } - - return $value; - } - /** * Helper to make a link to the page, taking the plaintext * value in consideration. -- 2.20.1