From 459f8651ab292069f5aa0f3fa7345178a643d13a Mon Sep 17 00:00:00 2001 From: cenarium Date: Sat, 14 Nov 2015 06:32:33 +0100 Subject: [PATCH] Use distinct log actions for patrol A distinct log action is provided for automatic patrols. The old 'auto' param is preserved so that old log entries can still be correctly identified in logs and API queries. With I6a61175f9a111c03d15b4d41751c818e3a411ff6, this enables us to filter new manual patrol entries in logs. Old automatic entries will be in the wrong list, but still marked as automatic. Bug: T27799 Change-Id: I05d962fa3ec45039122bb7e370b7e3fb8bbaa3c8 --- includes/DefaultSettings.php | 5 +++++ includes/logging/PatrolLog.php | 4 +++- includes/logging/PatrolLogFormatter.php | 6 +++--- languages/i18n/en.json | 3 +++ languages/i18n/qqq.json | 3 +++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3b2c69741e..2aefc64a3c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -7218,6 +7218,7 @@ $wgLogActionsHandlers = [ 'move/move' => 'MoveLogFormatter', 'move/move_redir' => 'MoveLogFormatter', 'patrol/patrol' => 'PatrolLogFormatter', + 'patrol/autopatrol' => 'PatrolLogFormatter', 'protect/modify' => 'ProtectLogFormatter', 'protect/move_prot' => 'ProtectLogFormatter', 'protect/protect' => 'ProtectLogFormatter', @@ -7255,6 +7256,10 @@ $wgActionFilteredLogs = [ 'event' => [ 'event' ], 'revision' => [ 'revision' ], ], + 'patrol' => [ + 'patrol' => [ 'patrol' ], + 'autopatrol' => [ 'autopatrol' ], + ], 'protect' => [ 'protect' => [ 'protect' ], 'modify' => [ 'modify' ], diff --git a/includes/logging/PatrolLog.php b/includes/logging/PatrolLog.php index f6ecc501a3..d1de2cd3ae 100644 --- a/includes/logging/PatrolLog.php +++ b/includes/logging/PatrolLog.php @@ -58,7 +58,9 @@ class PatrolLog { $user = $wgUser; } - $entry = new ManualLogEntry( 'patrol', 'patrol' ); + $action = $auto ? 'autopatrol' : 'patrol'; + + $entry = new ManualLogEntry( 'patrol', $action ); $entry->setTarget( $rc->getTitle() ); $entry->setParameters( self::buildParams( $rc, $auto ) ); $entry->setPerformer( $user ); diff --git a/includes/logging/PatrolLogFormatter.php b/includes/logging/PatrolLogFormatter.php index e6f9fb64cd..5b933ce269 100644 --- a/includes/logging/PatrolLogFormatter.php +++ b/includes/logging/PatrolLogFormatter.php @@ -30,11 +30,11 @@ */ class PatrolLogFormatter extends LogFormatter { protected function getMessageKey() { - $key = parent::getMessageKey(); $params = $this->getMessageParameters(); if ( isset( $params[5] ) && $params[5] ) { - // Messages: logentry-patrol-patrol-auto - $key .= '-auto'; + $key = 'logentry-patrol-patrol-auto'; + } else { + $key = 'logentry-patrol-patrol'; } return $key; diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 5ae694e7f3..d1f7abcffd 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -4032,6 +4032,7 @@ "randomrootpage": "Random root page", "log-action-filter-block": "Type of block:", "log-action-filter-delete": "Type of deletion:", + "log-action-filter-patrol": "Type of patrol:", "log-action-filter-protect": "Type of protection:", "log-action-filter-upload": "Type of upload:", "log-action-filter-all": "All", @@ -4042,6 +4043,8 @@ "log-action-filter-delete-restore": "Page undeletion", "log-action-filter-delete-event": "Log deletion", "log-action-filter-delete-revision": "Revision deletion", + "log-action-filter-patrol-patrol": "Manual patrol", + "log-action-filter-patrol-autopatrol": "Automatic patrol", "log-action-filter-protect-protect": "Protection", "log-action-filter-protect-modify": "Protection modification", "log-action-filter-protect-unprotect": "Unprotection", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 1c144ddb14..a8eb69642d 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -4208,6 +4208,7 @@ "randomrootpage": "{{doc-special|RandomRootPage}}", "log-action-filter-block": "Which type of action to filter for in this log", "log-action-filter-delete": "Which type of action to filter for in this log", + "log-action-filter-patrol": "Which type of action to filter for in this log", "log-action-filter-protect": "Which type of action to filter for in this log", "log-action-filter-upload": "Which type of action to filter for in this log", "log-action-filter-all": "All types of action are allowed", @@ -4218,6 +4219,8 @@ "log-action-filter-delete-restore": "Action to filter for in this log", "log-action-filter-delete-event": "Action to filter for in this log", "log-action-filter-delete-revision": "Action to filter for in this log", + "log-action-filter-patrol-patrol": "Action to filter for in this log", + "log-action-filter-patrol-autopatrol": "Action to filter for in this log", "log-action-filter-protect-protect": "Action to filter for in this log", "log-action-filter-protect-modify": "Action to filter for in this log", "log-action-filter-protect-unprotect": "Action to filter for in this log", -- 2.20.1