Merge "Don't construct SpecialPages twice"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 2 Apr 2016 17:51:43 +0000 (17:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 2 Apr 2016 17:51:43 +0000 (17:51 +0000)
includes/DefaultSettings.php
includes/api/i18n/en.json
includes/changes/EnhancedChangesList.php
includes/resourceloader/ResourceLoaderImage.php
includes/search/SearchExactMatchRescorer.php
languages/i18n/en.json
languages/i18n/qqq.json
languages/messages/MessagesCs.php

index 0e6aabb..facb92f 100644 (file)
@@ -6480,6 +6480,10 @@ $wgUnwatchedPageThreshold = false;
  *   'legend' => 'legend-msg',
  *   // optional (defaults to 'flag'), CSS class to put on changes lists rows
  *   'class' => 'css-class',
+ *   // optional (defaults to 'any'), how top-level flag is determined.  'any'
+ *   // will set the top-level flag if any line contains the flag, 'all' will
+ *   // only be set if all lines contain the flag.
+ *   'grouping' => 'any',
  * );
  * @endcode
  *
@@ -6490,23 +6494,27 @@ $wgRecentChangesFlags = [
                'letter' => 'newpageletter',
                'title' => 'recentchanges-label-newpage',
                'legend' => 'recentchanges-legend-newpage',
+               'grouping' => 'any',
        ],
        'minor' => [
                'letter' => 'minoreditletter',
                'title' => 'recentchanges-label-minor',
                'legend' => 'recentchanges-legend-minor',
                'class' => 'minoredit',
+               'grouping' => 'all',
        ],
        'bot' => [
                'letter' => 'boteditletter',
                'title' => 'recentchanges-label-bot',
                'legend' => 'recentchanges-legend-bot',
                'class' => 'botedit',
+               'grouping' => 'all',
        ],
        'unpatrolled' => [
                'letter' => 'unpatrolledletter',
                'title' => 'recentchanges-label-unpatrolled',
                'legend' => 'recentchanges-legend-unpatrolled',
+               'grouping' => 'any',
        ],
 ];
 
index 2d1542e..ad5ddfd 100644 (file)
@@ -20,7 +20,7 @@
        "apihelp-main-param-uselang": "Language to use for message translations. <kbd>[[Special:ApiHelp/query+siteinfo|action=query&meta=siteinfo]]</kbd> with <kbd>siprop=languages</kbd> returns a list of language codes, or specify <kbd>user</kbd> to use the current user's language preference, or specify <kbd>content</kbd> to use this wiki's content language.",
 
        "apihelp-block-description": "Block a user.",
-       "apihelp-block-param-user": "Username, IP address, or IP range to block.",
+       "apihelp-block-param-user": "Username, IP address, or IP address range to block.",
        "apihelp-block-param-expiry": "Expiry time. May be relative (e.g. <kbd>5 months</kbd> or <kbd>2 weeks</kbd>) or absolute (e.g. <kbd>2014-09-18T12:34:56Z</kbd>). If set to <kbd>infinite</kbd>, <kbd>indefinite</kbd>, or <kbd>never</kbd>, the block will never expire.",
        "apihelp-block-param-reason": "Reason for block.",
        "apihelp-block-param-anononly": "Block anonymous users only (i.e. disable anonymous edits for this IP address).",
        "apihelp-query+blocks-param-end": "The timestamp to stop enumerating at.",
        "apihelp-query+blocks-param-ids": "List of block IDs to list (optional).",
        "apihelp-query+blocks-param-users": "List of users to search for (optional).",
-       "apihelp-query+blocks-param-ip": "Get all blocks applying to this IP or CIDR range, including range blocks.\nCannot be used together with <var>$3users</var>. CIDR ranges broader than IPv4/$1 or IPv6/$2 are not accepted.",
+       "apihelp-query+blocks-param-ip": "Get all blocks applying to this IP address range or CIDR range, including range blocks.\nCannot be used together with <var>$3users</var>. CIDR ranges broader than IPv4/$1 or IPv6/$2 are not accepted.",
        "apihelp-query+blocks-param-limit": "The maximum number of blocks to list.",
        "apihelp-query+blocks-param-prop": "Which properties to get:",
        "apihelp-query+blocks-paramvalue-prop-id": "Adds the ID of the block.",
 
        "apihelp-unblock-description": "Unblock a user.",
        "apihelp-unblock-param-id": "ID of the block to unblock (obtained through <kbd>list=blocks</kbd>). Cannot be used together with <var>$1user</var>.",
-       "apihelp-unblock-param-user": "Username, IP address or IP range to unblock. Cannot be used together with <var>$1id</var>.",
+       "apihelp-unblock-param-user": "Username, IP address or IP address range to unblock. Cannot be used together with <var>$1id</var>.",
        "apihelp-unblock-param-reason": "Reason for unblock.",
        "apihelp-unblock-param-tags": "Change tags to apply to the entry in the block log.",
        "apihelp-unblock-example-id": "Unblock block ID #<kbd>105</kbd>.",
index 946c6d1..d79f316 100644 (file)
@@ -157,8 +157,10 @@ class EnhancedChangesList extends ChangesList {
         * Enhanced RC group
         * @param RCCacheEntry[] $block
         * @return string
+        * @throws DomainException
         */
        protected function recentChangesBlockGroup( $block ) {
+               $recentChangesFlags = $this->getConfig()->get( 'RecentChangesFlags' );
 
                # Add the namespace and title of the block as part of the class
                $tableClasses = [ 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' ];
@@ -186,20 +188,24 @@ class EnhancedChangesList extends ChangesList {
                $namehidden = true;
                $allLogs = true;
                $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
-               $collectedRcFlags = [
-                       // All are by bots?
-                       'bot' => true,
-                       // Includes a new page?
-                       'newpage' => false,
-                       // All are minor edits?
-                       'minor' => true,
-                       // Contains an unpatrolled edit?
-                       'unpatrolled' => false,
-               ];
-               foreach ( $block as $rcObj ) {
-                       if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
-                               $collectedRcFlags['newpage'] = true;
+
+               # Default values for RC flags
+               $collectedRcFlags = [];
+               foreach ( $recentChangesFlags as $key => $value ) {
+                       $flagGrouping = ( isset( $recentChangesFlags[$key]['grouping'] ) ?
+                                       $recentChangesFlags[$key]['grouping'] : 'any' );
+                       switch ( $flagGrouping ) {
+                               case 'all':
+                                       $collectedRcFlags[$key] = true;
+                                       break;
+                               case 'any':
+                                       $collectedRcFlags[$key] = false;
+                                       break;
+                               default:
+                                       throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
                        }
+               }
+               foreach ( $block as $rcObj ) {
                        // If all log actions to this page were hidden, then don't
                        // give the name of the affected page for this block!
                        if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
@@ -209,9 +215,6 @@ class EnhancedChangesList extends ChangesList {
                        if ( !isset( $userlinks[$u] ) ) {
                                $userlinks[$u] = 0;
                        }
-                       if ( $rcObj->unpatrolled ) {
-                               $collectedRcFlags['unpatrolled'] = true;
-                       }
                        if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
                                $allLogs = false;
                        }
@@ -221,13 +224,6 @@ class EnhancedChangesList extends ChangesList {
                                $curId = $rcObj->mAttribs['rc_cur_id'];
                        }
 
-                       if ( !$rcObj->mAttribs['rc_bot'] ) {
-                               $collectedRcFlags['bot'] = false;
-                       }
-                       if ( !$rcObj->mAttribs['rc_minor'] ) {
-                               $collectedRcFlags['minor'] = false;
-                       }
-
                        $userlinks[$u]++;
                }
 
@@ -267,6 +263,27 @@ class EnhancedChangesList extends ChangesList {
                                // completely ignore this RC entry if we don't want to render it
                                unset( $block[$i] );
                        }
+
+                       // Roll up flags
+                       foreach ( $line['recentChangesFlagsRaw'] as $key => $value ) {
+                               $flagGrouping = ( isset( $recentChangesFlags[$key]['grouping'] ) ?
+                                       $recentChangesFlags[$key]['grouping'] : 'any' );
+                               switch ( $flagGrouping ) {
+                                       case 'all':
+                                               if ( !$value ) {
+                                                       $collectedRcFlags[$key] = false;
+                                               }
+                                               break;
+                                       case 'any':
+                                               if ( $value ) {
+                                                       $collectedRcFlags[$key] = true;
+                                               }
+                                               break;
+                                       default:
+                                               throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
+                               }
+                       }
+
                        $lines[] = $line;
                }
                // Further down are some assumptions that $block is a 0-indexed array
@@ -436,8 +453,11 @@ class EnhancedChangesList extends ChangesList {
                        return [];
                }
 
+               $lineParams['recentChangesFlagsRaw'] = [];
                if ( isset( $data['recentChangesFlags'] ) ) {
                        $lineParams['recentChangesFlags'] = $this->recentChangesFlags( $data['recentChangesFlags'] );
+                       # FIXME: This is used by logic, don't return it in the template params.
+                       $lineParams['recentChangesFlagsRaw'] = $data['recentChangesFlags'];
                        unset( $data['recentChangesFlags'] );
                }
 
index f784d03..87e5fd7 100644 (file)
@@ -179,7 +179,7 @@ class ResourceLoaderImage {
                        'version' => $context->getVersion(),
                ];
 
-               return wfExpandUrl( wfAppendQuery( $script, $query ), PROTO_RELATIVE );
+               return wfAppendQuery( $script, $query );
        }
 
        /**
index d3b9d5c..40cfe39 100644 (file)
@@ -41,7 +41,7 @@ class SearchExactMatchRescorer {
         */
        public function rescore( $search, $namespaces, $srchres, $limit ) {
                // Pick namespace (based on PrefixSearch::defaultSearchBackend)
-               $ns = in_array( NS_MAIN, $namespaces ) ? NS_MAIN : $namespaces[0];
+               $ns = in_array( NS_MAIN, $namespaces ) ? NS_MAIN : reset( $namespaces );
                $t = Title::newFromText( $search, $ns );
                if ( !$t || !$t->exists() ) {
                        // No exact match so just return the search results
index c26d2a9..db8abbd 100644 (file)
        "noemail": "There is no email address recorded for user \"$1\".",
        "noemailcreate": "You need to provide a valid email address.",
        "passwordsent": "A new password has been sent to the email address registered for \"$1\".\nPlease log in again after you receive it.",
-       "blocked-mailpassword": "Your IP address is blocked from editing, and so is not allowed to use the password recovery function to prevent abuse.",
+       "blocked-mailpassword": "Your IP address is blocked from editing. To prevent abuse, it is not allowed to use password recovery from this IP address.",
        "eauthentsent": "A confirmation email has been sent to the specified email address.\nBefore any other email is sent to the account, you will have to follow the instructions in the email, to confirm that the account is actually yours.",
        "throttled-mailpassword": "A password reset email has already been sent, within the last {{PLURAL:$1|hour|$1 hours}}.\nTo prevent abuse, only one password reset email will be sent per {{PLURAL:$1|hour|$1 hours}}.",
        "signupstart": "",
        "uploadstash-summary": "This page provides access to files that are uploaded or in the process of uploading, but are not yet published to the wiki. These files are not visible to anyone but the user who uploaded them.",
        "uploadstash-clear": "Clear stashed files",
        "uploadstash-nofiles": "You have no stashed files.",
-       "uploadstash-badtoken": "Performing that action failed. Perhaps because your editing credentials expired. Please try again.",
+       "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",
        "unblock-summary": "",
        "blockip": "Block {{GENDER:$1|user}}",
        "blockip-legend": "Block user",
-       "blockiptext": "Use the form below to block write access from a specific IP address or username.\nThis should be done only to prevent vandalism, and in accordance with [[{{MediaWiki:Policy-url}}|policy]].\nFill in a specific reason below (for example, citing particular pages that were vandalized).\nYou can block IP ranges using the [https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing CIDR] syntax; the largest allowed range is /$1 for IPv4 and /$2 for IPv6.",
+       "blockiptext": "Use the form below to block write access from a specific IP address or username.\nThis should be done only to prevent vandalism, and in accordance with [[{{MediaWiki:Policy-url}}|policy]].\nFill in a specific reason below (for example, citing particular pages that were vandalized).\nYou can block IP address ranges using the [https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing CIDR] syntax; the largest allowed range is /$1 for IPv4 and /$2 for IPv6.",
        "ipaddressorusername": "IP address or username:",
        "ipbexpiry": "Expiration:",
        "ipbreason": "Reason:",
        "unblock-hideuser": "You cannot unblock this user, as their username has been hidden.",
        "ipb_cant_unblock": "Error: Block ID $1 not found. It may have been unblocked already.",
        "ipb_blocked_as_range": "Error: The IP address $1 is not blocked directly and cannot be unblocked.\nIt is, however, blocked as part of the range $2, which can be unblocked.",
-       "ip_range_invalid": "Invalid IP range.",
+       "ip_range_invalid": "Invalid IP address range.",
        "ip_range_toolarge": "Range blocks larger than /$1 are not allowed.",
        "proxyblocker": "Proxy blocker",
        "proxyblockreason": "Your IP address has been blocked because it is an open proxy.\nPlease contact your Internet service provider or technical support of your organization and inform them of this serious security problem.",
index e7df244..bdba606 100644 (file)
        "undo-summary-username-hidden": "Edit summary for an undo action where the username of the old revision is hidden.\n\nParameters:\n* $1 - the revision ID being undone\nSee also:\n* {{msg-mw|Undo-summary}}",
        "cantcreateaccounttitle": "Used as title of the error message {{msg-mw|Cantcreateaccount-text}}.",
        "cantcreateaccount-text": "Used as error message, with the title {{msg-mw|Cantcreateaccounttitle}}.\n* $1 - target IP address\n* $2 - reason or {{msg-mw|Blockednoreason}}\n* $3 - username\nSee also:\n* {{msg-mw|Cantcreateaccount-range-text}}",
-       "cantcreateaccount-range-text": "Used as more detailed version of the {{msg-mw|Cantcreateaccount-text}} error message, with the title {{msg-mw|Cantcreateaccounttitle}}.\n* $1 - target IP range\n* $2 - reason or {{msg-mw|Blockednoreason}}\n* $3 - username\n* $4 - current user's IP address",
+       "cantcreateaccount-range-text": "Used as more detailed version of the {{msg-mw|Cantcreateaccount-text}} error message, with the title {{msg-mw|Cantcreateaccounttitle}}.\n* $1 - target IP address range\n* $2 - reason or {{msg-mw|Blockednoreason}}\n* $3 - username\n* $4 - current user's IP address",
        "createaccount-hook-aborted": "Placeholder message to return with API errors on account create; passes through the message from a hook {{notranslate}}",
        "viewpagelogs": "Link displayed in history of pages",
        "nohistory": "Message shown when there are no history to list. See [{{canonicalurl:x|action=history}} example history].\n----\nAlso used as title of error message when the feed is empty. See [{{canonicalurl:x|action=history&feed=atom}} example feed].\n\nSee the error message:\n* {{msg-mw|history-feed-empty}}",
        "ipb-otherblocks-header": "[[File:Special.Block with other blocks from GlobalBlocking and TorBlocks.png|thumb|Example]]\nUsed on [[Special:Block]] as header for other blocks, i.e. from GlobalBlocking or TorBlocks\n\nParameters:\n* $1 - number of blocks\nSee also:\n* {{msg-mw|Ipblocklist-otherblocks}}",
        "unblock-hideuser": "{{doc-singularthey}}",
        "ipb_cant_unblock": "Used as error message in [[Special:Unblock]]. Parameters:\n* $1 - block ID",
-       "ipb_blocked_as_range": "Used when unblock of a single IP fails. Parameters:\n* $1 - IP address\n* $2 - IP range",
+       "ipb_blocked_as_range": "Used when unblock of a single IP fails. Parameters:\n* $1 - IP address\n* $2 - IP address range",
        "ip_range_invalid": "Used as error message in [[Special:Block]].\n\nSee also:\n* {{msg-mw|Range block disabled}}\n* {{msg-mw|Ip range invalid}}\n* {{msg-mw|Ip range toolarge}}",
        "ip_range_toolarge": "Used as error message in [[Special:Block]]. Parameters:\n* $1 - a number from 0 to 32 for IPv4 (from 0 to 128 for IPv6); a part of CIDR (Classless Inter-Domain Routing) notation.\nSee also:\n* {{msg-mw|Range block disabled}}\n* {{msg-mw|Ip range invalid}}\n* {{msg-mw|Ip range toolarge}}",
        "proxyblocker": "Used in [[Special:BlockMe]].\n\nSee also:\n* {{msg-mw|proxyblocker-disabled}}\n* {{msg-mw|proxyblockreason}}\n* {{msg-mw|proxyblocksuccess}}",
index 9878b47..548b78c 100644 (file)
@@ -72,12 +72,12 @@ $specialPageAliases = [
        'Filepath'                  => [ 'Cesta_k_souboru' ],
        'Import'                    => [ 'Importovat_stránky' ],
        'Invalidateemail'           => [ 'Zneplatnit_e-mail', 'Zrušit_potvrzení_e-mailu' ],
-       'BlockList'                 => [ 'Blokovaní_uživatelé', 'Blokovani_uzivatele' ],
+       'BlockList'                 => [ 'Blokovaní_uživatelé', 'Blokovani_uzivatele', 'Zablokovaní_uživatelé' ],
        'LinkSearch'                => [ 'Hledání_odkazů', 'Hledani_odkazu' ],
        'Listadmins'                => [ 'Seznam_správců', 'Seznam_spravcu' ],
        'Listbots'                  => [ 'Seznam_botů', 'Seznam_botu' ],
        'Listfiles'                 => [ 'Seznam_souborů', 'Seznam_souboru' ],
-       'Listgrouprights'           => [ 'Seznam_uživatelských_práv', 'Seznam_uzivatelskych_prav' ],
+       'Listgrouprights'           => [ 'Práva_uživatelských_skupin', 'Seznam_uživatelských_práv', 'Seznam_uzivatelskych_prav' ],
        'Listredirects'             => [ 'Seznam_přesměrování', 'Seznam_presmerovani' ],
        'Listusers'                 => [ 'Uživatelé', 'Uzivatele', 'Seznam_uživatelů', 'Seznam_uzivatelu' ],
        'Lockdb'                    => [ 'Zamknout_databázi', 'Zamknout_databazi' ],
@@ -92,7 +92,7 @@ $specialPageAliases = [
        'Mostlinkedcategories'      => [ 'Nejpoužívanější_kategorie', 'Nejpouzivanejsi_kategorie' ],
        'Mostlinkedtemplates'       => [ 'Nejpoužívanější_šablony', 'Nejpouzivanejsi_sablony' ],
        'Mostrevisions'             => [ 'Stránky_s_nejvíce_editacemi', 'Stranky_s_nejvice_editacemi', 'Stránky_s_nejvyšším_počtem_editací' ],
-       'Movepage'                  => [ 'Přesunout_stránku' ],
+       'Movepage'                  => [ 'Přesunout_stránku', 'Přejmenovat_stránku' ],
        'Mycontributions'           => [ 'Mé_příspěvky', 'Me_prispevky' ],
        'Mypage'                    => [ 'Moje_stránka', 'Moje_stranka' ],
        'Mytalk'                    => [ 'Moje_diskuse' ],