From: Derick Alangi Date: Sun, 17 Feb 2019 11:38:12 +0000 (+0100) Subject: specials: Fix fatal MWNamespace exception on Special:Contributions X-Git-Tag: 1.34.0-rc.0~2791^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/supprimer.php?a=commitdiff_plain;h=77276ce02a6aaaec9e8e41591a857897047fb393;p=lhc%2Fweb%2Fwiklou.git specials: Fix fatal MWNamespace exception on Special:Contributions Namespaces with negative values (valid like -1 and -2 or invalid like less than -2), should not be processed as they do not have associated namespaces. Rather than throwing an exception, nicely tell the user the namespace is a negative value and doesn't have an associated namespace to it. Also, don't show any results, just load the form again so user can do another request but show reason for this behavior atop of form. Bug: T150324 Change-Id: I525d305a4dabb040110894d3230eeb5e04ff8336 --- diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 5b939efbee..6e0e1c84f6 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -152,6 +152,17 @@ class SpecialContributions extends IncludableSpecialPage { } $this->opts = ContribsPager::processDateFilter( $this->opts ); + if ( $this->opts['namespace'] < NS_MAIN ) { + $this->getOutput()->wrapWikiMsg( + "
\n\$1\n
", + [ + 'namespace-not-associated', + wfEscapeWikiText( $this->opts['namespace'] ), + ] ); + $out->addHTML( $this->getForm() ); + return; + } + $feedType = $request->getVal( 'feed' ); $feedParams = [ diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 81c305f59f..b0153f006d 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2534,6 +2534,7 @@ "anoncontribs": "Contributions", "contribsub2": "For {{GENDER:$3|$1}} ($2)", "contributions-userdoesnotexist": "User account \"$1\" is not registered.", + "namespace-not-associated": "Namespace \"$1\" is a negative value that does not have an associated namespace.", "nocontribs": "No changes were found matching these criteria.", "uctop": "current", "month": "From month (and earlier):", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 0c43cccefc..7815d24ed0 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2740,6 +2740,7 @@ "anoncontribs": "Same as {{msg-mw|mycontris}} but used for non-logged-in users.\n\nSee also:\n* {{msg-mw|Accesskey-pt-anoncontribs}}\n* {{msg-mw|Tooltip-pt-anoncontribs}}\n{{Identical|Contribution}}", "contribsub2": "Contributions for \"user\" (links). Parameters:\n* $1 is an IP address or a username, with a link which points to the user page (if registered user).\n* $2 is list of tool links. The list contains a link which has text {{msg-mw|Sp-contributions-talk}}.\n* $3 is a plain text username used for GENDER.\n{{Identical|For $1}}", "contributions-userdoesnotexist": "This message is used in [[Special:Contributions]]. It is used to tell the user that the name he searched for doesn't exist.\n\nParameters:\n* $1 - a username\n{{Identical|Userdoesnotexist}}", + "namespace-not-associated": "This message is used in [[Special:Contributions]] to tell users that use namespaces with negative value. It doesn't make sense to get associated nameapce(s) for such namespaces as it doesn't exist.", "nocontribs": "Used in [[Special:Contributions]] and [[Special:DeletedContributions]].\n\nSee examples: [[Special:Contributions/x]] and [[Special:DeletedContributions/x]].\n\nParameters:\n* $1 - (Unused) the user name", "uctop": "This message is used in [[Special:Contributions]]. It is used to show that a particular edit was the last made to a page. Example: 09:57, 11 February 2008 (hist) (diff) Pagename‎ (edit summary) (current)\n{{Identical|Current}}", "month": "Used in [[Special:Contributions]] and history pages ([{{fullurl:Sandbox|action=history}} example]), as label for a dropdown box to select a specific month to view the edits made in that month, and the earlier months. See also {{msg-mw|year}}.",