Page MenuHomePhabricator

bug34508.1.patch

Authored By
bzimport
Nov 22 2014, 12:11 AM
Size
2 KB
Referenced Files
None
Subscribers
None

bug34508.1.patch

Index: extensions/LegacyLogs/LegacyLogs.php
===================================================================
--- extensions/LegacyLogs/LegacyLogs.php (revision 0)
+++ extensions/LegacyLogs/LegacyLogs.php (revision 0)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Legacy logging for Wikimedia IRC
+ *
+ * @file
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
+
+if ( !defined( 'MEDIAWIKI' ) ) die();
+
+$dir = dirname( __FILE__ ) . '/';
+
+$wgExtensionMessagesFiles['LegacyLogs'] = $dir . 'LegacyLogs.i18n.php';
+
+$wgHooks['LogEntry::publish'][] = 'efLegacyLogsIrcFormat';
+
+function efLegacyLogsIrcFormat( $entry, $formatter, &$text ) {
+ $parameters = $entry->getParameters();
+ if ( $entry->getType() === 'move' && $entry->getSubtype() === 'move_redir' ) {
+ $movesource = $parameters['4::target'];
+ $movetarget = $entry->getTarget()->getText();
+ $text = wfMsg( '1movedto2_redir', $movesource, $movetarget);
+ }
+ // More log types here...
+ return true;
+}
+
+
Index: extensions/LegacyLogs/LegacyLogs.i18n.php
===================================================================
--- extensions/LegacyLogs/LegacyLogs.i18n.php (revision 0)
+++ extensions/LegacyLogs/LegacyLogs.i18n.php (revision 0)
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Legacy logging for Wikimedia IRC
+ *
+ * @file
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
+
+$messages = array();
+
+/** English
+ */
+$messages['en'] = array(
+ '1movedto2_redir' => 'moved [[$1]] to [[$2]] over redirect',
+);
Index: includes/logging/LogEntry.php
===================================================================
--- includes/logging/LogEntry.php (revision 111324)
+++ includes/logging/LogEntry.php (working copy)
@@ -456,13 +456,16 @@
$context = RequestContext::newExtraneousContext( $this->getTarget() );
$formatter->setContext( $context );
+ $actionText = $formatter->getPlainActionText();
+ wfRunHooks( 'LogEntry::publish', array( $this, $formatter, &$actionText ) );
+
$logpage = SpecialPage::getTitleFor( 'Log', $this->getType() );
$user = $this->getPerformer();
$rc = RecentChange::newLogEntry(
$this->getTimestamp(),
$logpage,
$user,
- $formatter->getPlainActionText(), // Used for IRC feeds
+ $actionText, // Used for IRC feeds
$user->isAnon() ? $user->getName() : '',
$this->getType(),
$this->getSubtype(),

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8404
Default Alt Text
bug34508.1.patch (2 KB)

Event Timeline