Merge "Enable filtering by action on Special:Log"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 25 Mar 2016 22:08:42 +0000 (22:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 25 Mar 2016 22:08:42 +0000 (22:08 +0000)
1  2 
includes/DefaultSettings.php
includes/logging/LogEventsList.php
languages/i18n/en.json
languages/i18n/qqq.json

@@@ -3081,11 -3081,10 +3081,11 @@@ $wgHtml5 = true
  
  /**
   * Defines the value of the version attribute in the &lt;html&gt; tag, if any.
 - * If $wgAllowRdfaAttributes is true, and this evaluates to boolean false
 - * (like if it's left at the default null value), it will be auto-initialized
 - * to the correct value for RDFa+HTML5.  As such, you should have no reason to
 - * ever actually set this to anything.
 + *
 + * If your wiki uses RDFa, set it to the correct value for RDFa+HTML5.
 + * Correct current values are 'HTML+RDFa 1.0' or 'XHTML+RDFa 1.0'.
 + * See also http://www.w3.org/TR/rdfa-in-html/#document-conformance
 + * @since 1.16
   */
  $wgHtml5Version = null;
  
@@@ -3106,6 -3105,17 +3106,6 @@@ $wgHTMLFormAllowTableFormat = true
   */
  $wgUseMediaWikiUIEverywhere = false;
  
 -/**
 - * Enabled RDFa attributes for use in wikitext.
 - * NOTE: Interaction with HTML5 is somewhat underspecified.
 - */
 -$wgAllowRdfaAttributes = false;
 -
 -/**
 - * Enabled HTML5 microdata attributes for use in wikitext.
 - */
 -$wgAllowMicrodataAttributes = false;
 -
  /**
   * Should we try to make our HTML output well-formed XML?  If set to false,
   * output will be a few bytes shorter, and the HTML will arguably be more
@@@ -3562,7 -3572,25 +3562,7 @@@ $wgResourceLoaderMinifierMaxLineLength 
   *
   * @deprecated since 1.26: Always declare dependencies.
   */
 -$wgIncludeLegacyJavaScript = true;
 -
 -/**
 - * Whether to ensure the mediawiki.util is loaded before other modules.
 - *
 - * Before MediaWiki 1.19, modules used to load less asynchronous which allowed
 - * modules to lack dependencies on 'popular' modules that were likely loaded already.
 - *
 - * This setting is to aid scripts during migration by providing mediawiki.util
 - * unconditionally (which was the most commonly missed dependency). It doesn't
 - * cover all missing dependencies obviously but should fix most of them.
 - *
 - * This should be removed at some point after site/user scripts have been fixed.
 - * Enable this if your wiki has a large amount of user/site scripts that are
 - * lacking dependencies.
 - *
 - * @deprecated since 1.26: Always declare dependencies.
 - */
 -$wgPreloadJavaScriptMwUtil = false;
 +$wgIncludeLegacyJavaScript = false;
  
  /**
   * Whether or not to assign configuration variables to the global window object.
@@@ -5945,7 -5973,7 +5945,7 @@@ $wgCachePrefix = false
  /**
   * Display the new debugging toolbar. This also enables profiling on database
   * queries and other useful output.
 - * Will disable file cache.
 + * Will be ignored if $wgUseFileCache or $wgUseSquid is enabled.
   *
   * @since 1.19
   */
@@@ -6210,15 -6238,14 +6210,15 @@@ $wgGitBin = '/usr/bin/git'
   * %h will be replaced by the short SHA-1 (7 first chars) and %H by the
   * full SHA-1 of the HEAD revision.
   * %r will be replaced with a URL-encoded version of $1.
 + * %R will be replaced with $1 and no URL-encoding
   *
   * @since 1.20
   */
  $wgGitRepositoryViewers = [
        'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' =>
 -              'https://git.wikimedia.org/tree/%r/%H',
 +              'https://phabricator.wikimedia.org/r/revision/%R;%H',
        'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' =>
 -              'https://git.wikimedia.org/tree/%r/%H',
 +              'https://phabricator.wikimedia.org/r/revision/%R;%H',
  ];
  
  /** @} */ # End of maintenance }
@@@ -7208,6 -7235,37 +7208,37 @@@ $wgLogActionsHandlers = 
        'upload/upload' => 'UploadLogFormatter',
  ];
  
+ /**
+  * List of log types that can be filtered by action types
+  *
+  * To each action is associated the list of log_action
+  * subtypes to search for, usually one, but not necessarily so
+  * Extensions may append to this array
+  * @since 1.27
+  */
+ $wgActionFilteredLogs = [
+       'block' => [
+               'block' => [ 'block' ],
+               'reblock' => [ 'reblock' ],
+               'unblock' => [ 'unblock' ],
+       ],
+       'delete' => [
+               'delete' => [ 'delete' ],
+               'restore' => [ 'restore' ],
+               'event' => [ 'event' ],
+               'revision' => [ 'revision' ],
+       ],
+       'protect' => [
+               'protect' => [ 'protect' ],
+               'modify' => [ 'modify' ],
+               'unprotect' => [ 'unprotect' ],
+       ],
+       'upload' => [
+               'upload' => [ 'upload' ],
+               'overwrite' => [ 'overwrite' ],
+       ],
+ ];
  /**
   * Maintain a log of newusers at Log/newusers?
   */
@@@ -40,6 -40,11 +40,11 @@@ class LogEventsList extends ContextSour
         */
        protected $showTagEditUI;
  
+       /**
+        * @var array
+        */
+       protected $allowedActions = null;
        /**
         * Constructor.
         * The first two parameters used to be $skin and $out, but now only a context
         * @param int $month Month
         * @param array $filter
         * @param string $tagFilter Tag to select by default
+        * @param string $action
         */
        public function showOptions( $types = [], $user = '', $page = '', $pattern = '', $year = 0,
-               $month = 0, $filter = null, $tagFilter = ''
+               $month = 0, $filter = null, $tagFilter = '', $action = null
        ) {
                global $wgScript, $wgMiserMode;
  
                        $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) );
                }
  
+               // Action filter
+               if ( $action !== null ) {
+                       $html .= Xml::tags( 'p', null, $this->getActionSelector( $types, $action ) );
+               }
                // Submit button
                $html .= Xml::submitButton( $this->msg( 'logeventslist-submit' )->text() );
  
                $selector = $this->getTypeSelector();
                $selector->setDefault( $queryType );
  
 -              return $selector->getHtml();
 +              return $selector->getHTML();
        }
  
        /**
                return '';
        }
  
+       /**
+        * Drop down menu for selection of actions that can be used to filter the log
+        * @param array $types
+        * @param string $action
+        * @return string
+        * @since 1.27
+        */
+       private function getActionSelector( $types, $action ) {
+               if ( $this->allowedActions === null || !count( $this->allowedActions ) ) {
+                       return '';
+               }
+               $html = '';
+               $html .= xml::label( wfMessage( 'log-action-filter-' . $types[0] )->text(),
+                       'action-filter-' .$types[0] ) . "\n";
+               $select = new XmlSelect( 'subtype' );
+               $select->addOption( wfMessage( 'log-action-filter-all' )->text(), '' );
+               foreach ( $this->allowedActions as $value ) {
+                       $msgKey = 'log-action-filter-' . $types[0] . '-' . $value;
+                       $select->addOption( wfMessage( $msgKey )->text(), $value );
+               }
+               $select->setDefault( $action );
+               $html .= $select->getHtml();
+               return $html;
+       }
+       /**
+        * Sets the action types allowed for log filtering
+        * To one action type may correspond several log_actions
+        * @param array $actions
+        * @since 1.27
+        */
+       public function setAllowedActions( $actions ) {
+               $this->allowedActions = $actions;
+       }
        /**
         * @return string
         */
diff --combined languages/i18n/en.json
        "moredotdotdot": "More...",
        "morenotlisted": "This list is not complete.",
        "mypage": "Page",
 -      "anonuserpage": "Unknown user",
        "mytalk": "Talk",
        "anontalk": "Talk",
        "navigation": "Navigation",
        "recentchangeslinked-page": "Page name:",
        "recentchangeslinked-to": "Show changes to pages linked to the given page instead",
        "recentchanges-page-added-to-category": "[[:$1]] added to category",
 -      "recentchanges-page-added-to-category-bundled": "[[:$1]] and {{PLURAL:$2|one page|$2 pages}} added to category",
 +      "recentchanges-page-added-to-category-bundled": "[[:$1]] and [[Special:WhatLinksHere/$1|{{PLURAL:$2|one page|$2 pages}}]] added to category",
        "recentchanges-page-removed-from-category": "[[:$1]] removed from category",
 -      "recentchanges-page-removed-from-category-bundled": "[[:$1]] and {{PLURAL:$2|one page|$2 pages}} removed from category",
 +      "recentchanges-page-removed-from-category-bundled": "[[:$1]] and [[Special:WhatLinksHere/$1|{{PLURAL:$2|one page|$2 pages}}]] removed from category",
        "autochange-username": "MediaWiki automatic change",
        "upload": "Upload file",
        "uploadbtn": "Upload file",
        "uploadstash-badtoken": "Performing that action failed. Perhaps because your editing credentials expired. Please try again.",
        "uploadstash-errclear": "Clearing the files failed.",
        "uploadstash-refresh": "Refresh the list of files",
 +      "uploadstash-thumbnail": "view thumbnail",
        "invalid-chunk-offset": "Invalid chunk offset",
        "img-auth-accessdenied": "Access denied",
        "img-auth-nopathinfo": "Missing PATH_INFO.\nYour server is not set up to pass this information.\nIt may be CGI-based and cannot support img_auth.\nSee https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Image_Authorization.",
        "sessionprovider-generic": "$1 sessions",
        "sessionprovider-mediawiki-session-cookiesessionprovider": "cookie-based sessions",
        "sessionprovider-nocookies": "Cookies may be disabled. Ensure you have cookies enabled and start again.",
-       "randomrootpage": "Random root page"
+       "randomrootpage": "Random root page",
+       "log-action-filter-block": "Type of block:",
+       "log-action-filter-delete": "Type of deletion:",
+       "log-action-filter-protect": "Type of protection:",
+       "log-action-filter-upload": "Type of upload:",
+       "log-action-filter-all": "All",
+       "log-action-filter-block-block": "Block",
+       "log-action-filter-block-reblock": "Block modification",
+       "log-action-filter-block-unblock": "Unblock",
+       "log-action-filter-delete-delete": "Page deletion",
+       "log-action-filter-delete-restore": "Page undeletion",
+       "log-action-filter-delete-event": "Log deletion",
+       "log-action-filter-delete-revision": "Revision deletion",
+       "log-action-filter-protect-protect": "Protection",
+       "log-action-filter-protect-modify": "Protection modification",
+       "log-action-filter-protect-unprotect": "Unprotection",
+       "log-action-filter-upload-upload": "New upload",
+       "log-action-filter-upload-overwrite": "Reupload"
  }
diff --combined languages/i18n/qqq.json
        "moredotdotdot": "Used as \"More...\" link for {{msg-mw|pageinfo-transclusions}} field, in the \"templates used on this page\" list.\n\nSimilar to {{msg-mw|morenotlisted}}.\n{{Identical|More...}}",
        "morenotlisted": "An indication that more of a templates list is not shown.\n\nUsed as \"More...\" link for {{msg-mw|pageinfo-templates}} field.\n\nSimilar to {{msg-mw|moredotdotdot}}.",
        "mypage": "A text for the link to the user's user page in the links at the top of the page.\n{{Identical|Page}}",
 -      "anonuserpage": "Same as {{msg-mw|mypage}} but used for non-logged-in users.\nA text for the link to the IP user page in the links at the top of the page.\n\nSee also:\n* {{msg-mw|Accesskey-pt-anonuserpage}}\n* {{msg-mw|Tooltip-pt-anonuserpage}}",
        "mytalk": "In the personal URLs page section - right upper corner.\n\nUsed as link title in your personal toolbox.\n\nSee also:\n* {{msg-mw|Mytalk}}\n* {{msg-mw|Accesskey-pt-mytalk}}\n* {{msg-mw|Tooltip-pt-mytalk}}\n{{Identical|Talk}}",
        "anontalk": "Same as {{msg-mw|mytalk}} but used for non-logged-in users.\n{{Identical|Talk}}\n\nSee also:\n* {{msg-mw|Accesskey-pt-anontalk}}\n* {{msg-mw|Tooltip-pt-anontalk}}",
        "navigation": "This is shown as a section header in the sidebar of most skins.\n\n{{Identical|Navigation}}",
        "uploadstash-badtoken": "Used as error message in [[Special:UploadStash]].",
        "uploadstash-errclear": "Used as error message in [[Special:UploadStash]].",
        "uploadstash-refresh": "Used as link text in [[Special:UploadStash]].",
 +      "uploadstash-thumbnail": "Used as link text in [[Special:UploadStash]].",
        "invalid-chunk-offset": "Error that can happen if chunks get uploaded out of order.\nAs a result of this error, clients can continue from an offset provided or restart the upload.\nUsed on [[Special:UploadWizard]].",
        "img-auth-accessdenied": "[[mw:Manual:Image Authorization|Manual:Image Authorization]]: Access Denied\n{{Identical|Access denied}}",
        "img-auth-nopathinfo": "[[mw:Manual:Image Authorization|Manual:Image Authorization]]: Missing PATH_INFO - see english description\n{{Doc-important|This is plain text. Do not use any wiki syntax.}}",
        "sessionprovider-generic": "Used to create a generic session type description when one isn't provided via the proper message. Should be phrased to make sense when added to a message such as {{msg-mw|cannotloginnow-text}}.\n\nParameters:\n* $1 - PHP classname.",
        "sessionprovider-mediawiki-session-cookiesessionprovider": "Description of the sessions provided by the CookieSessionProvider class, which use HTTP cookies. Should be phrased to make sense when added to a message such as {{msg-mw|cannotloginnow-text}}.",
        "sessionprovider-nocookies": "Used to inform the user that sessions may be missing due to lack of cookies.",
-       "randomrootpage": "{{doc-special|RandomRootPage}}"
+       "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-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-block-block": "Action to filter for in this log",
+       "log-action-filter-block-reblock": "Action to filter for in this log",
+       "log-action-filter-block-unblock": "Action to filter for in this log",
+       "log-action-filter-delete-delete": "Action to filter for in this log",
+       "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-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",
+       "log-action-filter-upload-upload": "Action to filter for in this log",
+       "log-action-filter-upload-overwrite": "Action to filter for in this log"
  }