From: Sam Reed Date: Tue, 21 Feb 2012 21:26:15 +0000 (+0000) Subject: First merge of the rest of the code from bug 34508 patch 1 and patch 3 X-Git-Tag: 1.31.0-rc.0~24588 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=58c7cf14d39d7361da8505bca0233108bda80bf7;p=lhc%2Fweb%2Fwiklou.git First merge of the rest of the code from bug 34508 patch 1 and patch 3 --- diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index b2c4e1ba65..ae6183faaa 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -462,7 +462,7 @@ class ManualLogEntry extends LogEntryBase { $this->getTimestamp(), $logpage, $user, - $formatter->getPlainActionText(), // Used for IRC feeds + $formatter->getIRCActionText(), // Used for IRC feeds $user->isAnon() ? $user->getName() : '', $this->getType(), $this->getSubtype(), diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index 6c454b3c95..594071a2bc 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -77,6 +77,8 @@ class LogFormatter { */ protected $plaintext = false; + protected $irctext = false; + protected function __construct( LogEntry $entry ) { $this->entry = $entry; $this->context = RequestContext::getMain(); @@ -140,6 +142,39 @@ class LogFormatter { return $text; } + /** + * Even uglier hack to maintain backwards compatibilty with IRC bots + * (bug 34508). + * @see getActionText() + * @return string text + */ + public function getIRCActionText() { + $this->irctext = true; + $this->plaintext = true; + $text = $this->getActionText(); + + // wfRunHooks( 'LogEntry::publish', array( $this, $formatter, &$actionText ) ); + // function efLegacyLogsIrcFormat( $entry, $formatter, &$text ) { + + $entry = $this->entry; + $parameters = $entry->getParameters(); + switch ( $this->entry ) { + case 'move': + if ( $this->entry->getSubtype() === 'move_redir' ) { + $movesource = $parameters['4::target']; + $movetarget = $entry->getTarget()->getText(); + $text = wfMsg( '1movedto2_redir', $movesource, $movetarget ); + } + break; + // case 'delete': + // break + } + + $this->plaintext = false; + $this->irctext = false; + return $text; + } + /** * Gets the log action, including username. * @return string HTML @@ -183,7 +218,13 @@ class LogFormatter { protected function getMessageKey() { $type = $this->entry->getType(); $subtype = $this->entry->getSubtype(); - $key = "logentry-$type-$subtype"; + if( $this->irctext ) { + $key = "logentry-irc-$type-$subtype"; + } + else { + $key = "logentry-$type-$subtype"; + } + return $key; }