Use distinct log actions for patrol
authorcenarium <cenarium.sysop@gmail.com>
Sat, 14 Nov 2015 05:32:33 +0000 (06:32 +0100)
committerRoan Kattouw <roan.kattouw@gmail.com>
Fri, 25 Mar 2016 22:04:11 +0000 (15:04 -0700)
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
includes/logging/PatrolLog.php
includes/logging/PatrolLogFormatter.php
languages/i18n/en.json
languages/i18n/qqq.json

index 3b2c697..2aefc64 100644 (file)
@@ -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' ],
index f6ecc50..d1de2cd 100644 (file)
@@ -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 );
index e6f9fb6..5b933ce 100644 (file)
  */
 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;
index 5ae694e..d1f7abc 100644 (file)
        "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",
        "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",
index 1c144dd..a8eb696 100644 (file)
        "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",
        "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",