Commit graph

4827 commits

Author SHA1 Message Date
jenkins-bot
2c10ff9a9c Merge "Add 'ApiMakeParserOptions' hook" 2016-06-20 22:13:18 +00:00
Translation updater bot
becfbb8410 Localisation updates from https://translatewiki.net.
Change-Id: I3445e2be17bfe12e63d79bf8b5c5d74258b67e51
2016-06-20 21:54:50 +02:00
Brad Jorsch
7762a0cab6 Add 'ApiMakeParserOptions' hook
This allows extensions (e.g. TemplateSandbox in I77a9aa5a) to better
interact with the ApiParse and ApiExpandTemplates modules.

Change-Id: I72d5cf8e0b86e4250af1459219dc3b42d7adbbb8
2016-06-20 14:22:53 -04:00
Leszek Manicki
fc0fcc02a3 Fix documentation of the dir parameter of list=watchlistraw API action
Bug: T138213
Change-Id: I26709b03dd9b64c6f1231f3bfc3064c63c8f0c21
2016-06-20 14:12:59 +02:00
Translation updater bot
9a2066ccc3 Localisation updates from https://translatewiki.net.
Change-Id: I468bbcade78dcf0b9843b3bd6370cc3cabdf2e22
2016-06-18 21:56:05 +02:00
Aaron Schulz
6b192e6146 Improve edit stashing when vary-revision is used
At least avoid the first parse in doEditContent()/filters which
never has the revision set either. The second parse cannot be
avoided in doEditUpdates() however.

Bug: T136678
Change-Id: I12d2c3bbe1b21ad2ed9a484745d976ad62475e0d
2016-06-17 16:21:45 -07:00
Translation updater bot
533f9eb390 Localisation updates from https://translatewiki.net.
Change-Id: I99bcec90e06d89ea9a6e80ee24ef026bdfacf551
2016-06-17 21:53:33 +02:00
Translation updater bot
99ca687a10 Localisation updates from https://translatewiki.net.
Change-Id: Ic811056a74b4f7bff1494288258016d8e8d76a8d
2016-06-16 21:54:08 +02:00
Translation updater bot
7e4e3c80b9 Localisation updates from https://translatewiki.net.
Change-Id: I44a4502de201f88016a40febed54effb746d23be
2016-06-15 21:54:34 +02:00
Aaron Schulz
406d6a2b46 Perform edit stashing when the edit preview or diff form is requested
* Users are likely to save after they inspect and review their changes.
  The buttons to do so are also located below the edit summary box.
* This obsoletes the backend stashing on preview. Most of those parses
  would have been useless due to being per-section only. Also, some
  extensions like the Graph extension disable stashing for "preview"
  output anyway. Simplify the code by removing that method.

Bug: T136678
Change-Id: Ied77bdbd191dd9267d4295b0fa7b942f65b062db
2016-06-14 18:25:35 +00:00
Brad Jorsch
43b2693a33 API: Log non-whitelisted CORS requests with session cookies
As requested in T62835#1794915, this logs requests that have an Origin
header that isn't whitelisted and have "session" cookies (defined as
"cookies that SessionManager says to vary on").

Change-Id: I3e34ff1e3a0a3f63c709ee95aa5cf8309fbc4367
2016-06-14 12:20:17 -04:00
Aaron Schulz
cb68ff0230 Send the edit summary/user to the edit stash API
This can be useful for pre-caching AbuseFilter check results

Bug: T137698
Change-Id: I03e3924408a2a5da09a411b66d09958a1b78cb99
2016-06-13 22:40:50 +00:00
Translation updater bot
b9255066fd Localisation updates from https://translatewiki.net.
Change-Id: Ia3ca901c6a7ca042b2ab6690bf3affa7c8b3ffd4
2016-06-13 22:22:42 +02:00
Translation updater bot
0655e291cb Localisation updates from https://translatewiki.net.
Change-Id: Ia2e64c04c2a05e0b2eb041c138e6d0fb66674595
2016-06-12 21:54:56 +02:00
Translation updater bot
4f9a407e60 Localisation updates from https://translatewiki.net.
Change-Id: I0d96f471b50edd2d6cd15729377ea7b40e1bda21
2016-06-11 21:52:58 +02:00
Bartosz Dziewoński
070783d314 Revert "Make APIEditBeforeSave give the whole revision"
This may negatively affect performance and the whole purpose of the
hook (making it possible to reject an edit from an extension while
providing detailed error information in the API result) has been
invalidated by 09a5febb7b, which lets
EditFilterMergedContent do this too.

I think it was intentional that the hook was called with just the text
passed to action=edit API. Making it actually be called with the text
that's going to be saved would require more work (e.g. for
automatically resolved edit conflicts, T73947).

Very few extensions use this hook. I'm fixing AbuseFilter to use
EditFilterMergedContent in I30c1e3d0a6c10888e6ac53745313434474663cce,
we should also review ConfirmEdit, ProofreadPage and SpamBlacklist to
see what behavior they really expect.

This reverts commit be97167ab6.

Change-Id: I62713419496bcf57364a8fa9de93c0c8ddc3e91c
2016-06-10 21:29:30 +00:00
Translation updater bot
099d3b59a4 Localisation updates from https://translatewiki.net.
Change-Id: Ia93b8aad378646799ed1a6fc4a22e8fc2d3647b8
2016-06-10 21:53:43 +02:00
Aaron Schulz
a74346b9bb Add more logging info to parseAndStash() for uncacheable content
Change-Id: I2409f0db518d366a747aa01ba5593dccdb34e68c
2016-06-09 21:03:59 -07:00
Aaron Schulz
e40b678de0 Simplify ApiStashEdit::checkCache()
Per https://grafana.wikimedia.org/dashboard/db/edit-stash, the
proven_* cases are almost never hit. Simplify the code to avoid
complexity and slow link table queries.

Change-Id: I3f8bd79a80ddb26c6188b1a301c08766e38f6ad4
2016-06-09 21:02:40 +00:00
jenkins-bot
8799a1ecc0 Merge "Allow minor edits to be filtered out of Special:Contributions" 2016-06-09 20:13:28 +00:00
Translation updater bot
a71103f558 Localisation updates from https://translatewiki.net.
Change-Id: I816baca545df33e40659900cefe92add4c034ae9
2016-06-09 21:54:54 +02:00
Aaron Schulz
6f86660e23 Include title/user in some edit stash log messages
Change-Id: I49d61d9cfc5edacf415f6822cb50cc9007735a27
2016-06-09 07:16:17 +00:00
jenkins-bot
55e23b7c48 Merge "ApiQuerySiteInfo: Avoid extra getConfig() calls" 2016-06-09 03:08:25 +00:00
jenkins-bot
28de24e7a3 Merge "ApiQuerySiteInfo: Add $wgInterwikiMagic value" 2016-06-09 03:08:20 +00:00
Kunal Mehta
9a4ece7fc5 ApiQuerySiteInfo: Avoid extra getConfig() calls
Change-Id: Idfd11691cf579107162a730ded17c5101cd72463
2016-06-08 15:03:38 -07:00
Kunal Mehta
ddaaf59713 ApiQuerySiteInfo: Add $wgInterwikiMagic value
Bug: T131564
Change-Id: Ia7c1e944c0f65d8b1b940388aceb1f0f89005dc6
2016-06-08 15:02:39 -07:00
Translation updater bot
335bf49f8f Localisation updates from https://translatewiki.net.
Change-Id: Ia7ecf877adc3a35e9c02e27115095435f9484d94
2016-06-08 22:04:36 +02:00
Brad Jorsch
d83e655b8e API: Allow anonymous CORS from anywhere, when specifically requested
This allows any external site to do with CORS what they can already do
with jsonp: submit a request that will be processed as if logged out.

This is done by accepting '*' as a value for the existing 'origin' URL
parameter that is currently required in order to do any CORS requests
against MediaWiki.

The response to such a request will specifically include
"Access-Control-Allow-Credentials: false" to instruct the browser not to
send cookies or other authentication data, and further the API will
apply all the same restrictions (forcing an anonymous user and
forbidding certain actions such as token fetch) that it currently does
for jsonp requests.

Bug: T62835
Change-Id: I30e359fb23f0511242dfb4bff68718668947aaf5
2016-06-08 14:59:55 -04:00
Translation updater bot
d7096d396c Localisation updates from https://translatewiki.net.
Change-Id: I4174fc3bca40d45f06dd93af10d009d23acae375
2016-06-07 22:13:01 +02:00
jenkins-bot
9cbc779ae7 Merge "Call ChangeAuthenticationDataAudit from the API" 2016-06-07 14:02:16 +00:00
Gergő Tisza
8466e5c509 Call ChangeAuthenticationDataAudit from the API
Bug: T137193
Change-Id: I2f7a7da2eb9973ed8f946c52e9821ed962dcd7ba
2016-06-07 13:47:12 +00:00
Aaron Schulz
27e6e29888 Remove getOptions() checks from getStashKey() entirely
It only avoided a tiny edge case of options lag, which is
not worth the complexity.

Change-Id: I94bc35fc89eb46436a23b10aee1b7d339859c7ea
2016-06-06 17:27:37 -07:00
Aaron Schulz
58886b169a Make edit stash keys less preference sensitive
Only factor in the user ID/name/sig instead of anything that
might happen to touch the user row.

Bug: T136678
Change-Id: I004790a017c68cfcff6729f6fbfd0f79b6904c20
2016-06-06 22:03:11 +00:00
Translation updater bot
2da2c6eb1c Localisation updates from https://translatewiki.net.
Change-Id: I961120816132dc1a46f62e25b7223006a727aa32
2016-06-05 21:52:21 +02:00
Translation updater bot
b862718fc6 Localisation updates from https://translatewiki.net.
Change-Id: Ib2318bbccf83f08e9f32c97b6fea0c6baa6d1cd7
2016-06-03 22:47:23 +02:00
Erik Bernhardson
5e65ae8f64 Don't lose namespace when searching via api
A recent patch, I66be724d, introduced a regression that no longer
applied user selected namespaces to the search engine. Fix that up so we
give the correct responses to api rqeuests.

Change-Id: I8e5e180cb143ae3cddeb12f51bc7aae75b20fe58
2016-06-02 13:12:20 -07:00
Translation updater bot
bc789fd18c Localisation updates from https://translatewiki.net.
Change-Id: I1dc0bbb38277e8c24ace6b53e835d8d5020de50f
2016-06-02 21:55:40 +02:00
Translation updater bot
346e00bb7a Merge "Localisation updates from https://translatewiki.net." 2016-06-01 20:43:13 +00:00
jenkins-bot
ea41b271ee Merge "Expose SearchEngine specific profiles" 2016-06-01 20:36:03 +00:00
Translation updater bot
5fa1ba7e23 Localisation updates from https://translatewiki.net.
Change-Id: I58c9f2c935838e27afd48890da19fda98d6c792e
2016-06-01 22:34:22 +02:00
This, that and the other
2f622d3076 Allow minor edits to be filtered out of Special:Contributions
Just another checkbox and option flag...

Bug: T16086
Change-Id: Iacc66213798fa527adc3346fe1763ab0e04d2afe
2016-06-01 21:00:07 +10:00
jenkins-bot
0eee510586 Merge "Return error message in users API cancreate field" 2016-05-31 17:01:07 +00:00
jenkins-bot
d9fab38793 Merge "AuthManager fixups around the login→RESTART→create flow" 2016-05-31 16:41:53 +00:00
Brad Jorsch
9bb2875e2e AuthManager fixups around the login→RESTART→create flow
* ApiQueryAuthManagerInfo will differentiate between preserved linking
  data and a preserved createRequest.
* ApiQueryAuthManagerInfo will indicate the preserved username, if any,
  because the client will have to pass that back to action=createaccount.
* ApiClientLogin won't tell about the confusing
  CreateFromLoginAuthenticationRequest returned on RESTART responses.
* Explain how 'preservestate' works in ApiAMCreateAccount's auto-doc.
* ConfirmLinkSecondaryAuthenticationProvider will filter out requests
  that can no longer be used (i.e. if it was for linking the account
  that got used for creation).
* All the complicated code in AuthManager::beginAccountCreation() was
  trying to deal with allowing the client to pass only the
  CreateFromLoginAuthenticationRequest. That was dumb, removed it.
* Added methods to CreateFromLoginAuthenticationRequest to indicate its
  status with respect to different kinds of preserved state.
* Increase accuracy of the AuthenticationResponse::$createRequest doc.

Change-Id: I726d79de18e739d6e60c1eea51453433c21ba207
2016-05-31 11:44:02 -04:00
Translation updater bot
d27ae619c5 Localisation updates from https://translatewiki.net.
Change-Id: Iafc12789c203b6b3d1ce0f81136f139a023ed972
2016-05-30 21:56:25 +02:00
dcausse
31680aaddc Expose SearchEngine specific profiles
This patch introduces a way for SearchEngine implementations to expose
specific search profiles useful to fine-tune the various behaviors related to
search.

A SearchEngine can expose a list of profiles by overriding
SearchEngine::getProfiles( $profileType ), profileType stands for the type of
profile being customized. Two types are added in this patch:
- completion: exposed by ApiQueryPrefixSearch and ApiOpenSearch to control
  the behavior of the algorithm behind "search as you type" suggestions.
- fulltext query independent profiles: exposed by ApiQuerySearch to customize
  query indpendent ranking profiles (e.g. boost by templates/incoming
  links/popularity/...)

This patch allows api consumers that might have been confused by fuzzy
suggestions to switch to stricter profiles and to officialize the behavior
behind the hidden param cirrusUseCompletionSuggester. Or to control the
fulltext ranking behaviors like cirrusBoostLinks=(yes|no).

The list of profiles can be discovered by using ApiSandbox/ApiHelp and is totally
controlled by search engine implementations.

Bug: T132477
Change-Id: I66be724d8975976c98c91badbf421f237e014f89
2016-05-30 20:43:53 +02:00
Gergő Tisza
43f4a05ec3 Return error message in users API cancreate field
That API field exposes AuthManager::canCreateAccount, where the error
message is important.

Change-Id: Idef441b311b94ff0cb6c4deaed1ac93959ee7ee8
2016-05-30 20:16:07 +02:00
Timo Tijhof
227f0c3902 Fix rvtoken=rollback in ApiQueryRevisions
Follows-up 9af38c0. Token must match ApiRollback, RollbackAction,
Linker, and WikiPage. (This should not be in different 5 places!)

This broke the "PILT" gadget.

Bug: T136375
Change-Id: Ia6b6879a952925ec52fa627ba57991bc87fd947a
2016-05-30 17:16:30 +01:00
jenkins-bot
f4a2198abf Merge "API: Fixes for AuthManager" 2016-05-30 12:37:34 +00:00
Brad Jorsch
e10f96cff1 API: Fixes for AuthManager
* Set API response metadata on the AuthenticationRequest metadata so it
  is output as an assoc generally.
* Remove the 'image' field in AuthenticationRequest::getFieldInfo()'s
  response, since we ended up not using it anywhere.
* Make it so meta=authmanagerinfo can be used on private wikis without
  logging in, so action=clientlogin can be used to log in.
** This generalizes the exception for meta=tokens that was added in
   I83dafb030.
* ApiAuthManagerInfo needs the "messageformat" parameter.
* ApiAuthManagerInfo shouldn't be publically cached, since the responses
  vary depending on session state.

Change-Id: Iea5ddb4ef9febed18f16a7ae8314968026f39148
2016-05-30 08:25:19 -04:00
Translation updater bot
0e961a8f6a Localisation updates from https://translatewiki.net.
Change-Id: I8038db5de26e5efb0b801902e8ce51536af5e47b
2016-05-28 21:54:09 +02:00
Translation updater bot
dd738aac80 Localisation updates from https://translatewiki.net.
Change-Id: I47fe8c2cc2ff6457d934627dbe71842a34e4c48d
2016-05-27 21:58:00 +02:00
Aaron Schulz
5051edd835 Send edit stash metrics for cache attempts
Change-Id: I22d5626cca55c2cc35e1b33fced5902e8d364d40
2016-05-26 21:02:39 +00:00
jenkins-bot
34a6750d1f Merge "Bail out in ApiStashEdit for bots for sanity" 2016-05-26 20:11:01 +00:00
Translation updater bot
beb90781c0 Localisation updates from https://translatewiki.net.
Change-Id: I04fc4e9de4d4d0f4c8a13d559d6eafa91f1d70ac
2016-05-26 21:59:57 +02:00
Aaron Schulz
d690083213 Bail out in ApiStashEdit for bots for sanity
checkCache() is disabled in this case anyway.

Change-Id: I1c18585eecc1a7c4c0e24546799c7ee448b3ea57
2016-05-26 19:59:16 +00:00
Aaron Schulz
cddfe0d98f Exclude bots from edit stash stats
Change-Id: Id309879eaaf039de7ac5f531930fa8e758a959c7
2016-05-26 11:36:40 -07:00
jenkins-bot
6843a4c844 Merge "Avoid DBPerformance warnings on PURGE/TRACE requests" 2016-05-26 16:45:07 +00:00
Aaron Schulz
7f8d016f5a Avoid DBPerformance warnings on PURGE/TRACE requests
The former sometimes show up in the logs as they were causing
CentralAuth to use the master but the expectations treated
the request as a GET request. This makes things more
consistent.

Bug: T92357
Change-Id: I55bf3139c68f5926fe67a51cf0eb1b2ffe55d17b
2016-05-25 18:22:26 -07:00
jenkins-bot
61ac2e2d0e Merge "Use correct module name for stats in executeActionWithErrorHandling()" 2016-05-25 23:31:53 +00:00
Translation updater bot
fcb200fd49 Localisation updates from https://translatewiki.net.
Change-Id: I7108f988a2c97e99bb3f889d0ecea55fceb0d95f
2016-05-25 21:59:28 +02:00
Aaron Schulz
542640f4e2 Use correct module name for stats in executeActionWithErrorHandling()
Change-Id: I7d300525c32877d6fcc940962c93b932dc4c9181
2016-05-25 12:31:19 -07:00
Translation updater bot
0a26e28db1 Localisation updates from https://translatewiki.net.
Change-Id: I3941ec39a42414aa051ab58922267e143c5b30f1
2016-05-24 22:21:58 +02:00
jenkins-bot
4bd688c442 Merge "RollbackAction: Implement AJAX interface and require POST" 2016-05-23 21:02:50 +00:00
Translation updater bot
5bff74281b Localisation updates from https://translatewiki.net.
Change-Id: I00c9bd3bf3a03e38b1cc2573212bfae257d3dc4c
2016-05-23 22:00:48 +02:00
Timo Tijhof
9af38c046c RollbackAction: Implement AJAX interface and require POST
Similar to WatchAction (converted in commit 77cdf1919).

* Make FormAction::getFormFields not abstract.
  In most cases this will just be an empty array.

* Convert RollbackAction from FormlessAction to FormAction and implement the
  required error handling scenarios (mostly moved out of from the old method, or
  duplicated from the WikiPage method where necessary).

* In most cases the in-between form is never used since a JavaScript handler
  takes over the link and uses the API over AJAX instead. In the no-js fallback
  (as well as for any existing tokenless rollback links) copy the GET parameters
  into the form for re-submission as POST (plus token, added by HTMLForm).

* Remove the distinction between WebUI and API tokens. This stronger token salt made it
  unnecessarily complex and was only there because it used GET until now. This streamlining of
  tokens matches what we already do for 'watch', 'edit', 'patrol' and other actions.

* Fix form submission bugs when 'from' query parameter is missing.

  - Ensure the required 'from' query parameter is present before showing a form.
    No need for the user to submit a form we know will fail.

  - Plain GET request to action=rollback (with no parameters) is now a 400 Bad Request
    instead of a form that would fail when submitted.

  - Submitting the form without 'form' field now correctly says why it failed.
    Previously it emitted a session error, which was a lie.

Bug: T88044
Change-Id: Ia457802fec2e90573c8e7d552bc1f3cee258f10b
2016-05-23 20:00:48 +01:00
jenkins-bot
67a97fced6 Merge "Language: Introduce new method equals( Language $lang )" 2016-05-23 16:03:50 +00:00
Translation updater bot
dfabb9e95f Localisation updates from https://translatewiki.net.
Change-Id: Icdeee9242c04b5417eb60a2c268e88d9c0a40896
2016-05-22 21:58:03 +02:00
Translation updater bot
88754ec791 Localisation updates from https://translatewiki.net.
Change-Id: I81eef8d9acdd8a2f0e0adeca28bfad36882e0fe9
2016-05-21 21:59:59 +02:00
Amire80
a2f838d9c1 Add missing samp tags and closing kbd tag
In:
* apihelp-clientlogin-example-login2
* api-help-authmanager-general-usage

Also fix a typo in api-help-authmanager-general-usage.

Change-Id: I2a9f6c46c992fda9a21068dd789043d5ef626311
2016-05-21 13:26:00 +03:00
Translation updater bot
81d862e34d Localisation updates from https://translatewiki.net.
Change-Id: Ia6f9b128f9747919c7263200b639ef8207079f3f
2016-05-20 21:56:30 +02:00
umherirrender
72632115d6 Fix various phpcs error from last security patches
Found by tests:
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-trusty/1069/console

Breaking merges

Change-Id: If01b94705cd7b939ac380053730b1b602c838a8e
2016-05-20 20:20:36 +02:00
Brad Jorsch
8a00ddbf35 SECURITY: Rate limit moves via the API
While rate limiting has been applied to moves via the web UI since rate
limiting was first added, it appears that it was overlooked when ApiMove
was created.

This follows the same model as is followed by the web UI: each
submission to ApiMove is one "hit" for the rate limiter, even though
that submission might result in multiple pages being moved (e.g. the
page, its talk page, and its subpages) depending on the options and user
rights.

Bug: T132874
Change-Id: I564d8bfcc7dd3ad6d92dbbc33519a589697c0d4e

Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
2016-05-20 09:49:33 -07:00
Brad Jorsch
f459c1aeca SECURITY: Improve cross-domain-policy mangling
Take into account that the tag might have parameters.

Bug: T123653
Change-Id: Ie9799f5ea45badfb4e7b4be7e7fbc1c35cc86f26

Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
2016-05-20 09:48:11 -07:00
Brad Jorsch
9ec1ef7308 API: Add "standard" header and hook for lacksSameOriginSecurity()
The header is intended for use with XMLHttpRequest when the request
might be part of an XSS. The hook is for extensions that might need to
add additional checks of some sort.

Bug: T98313
Change-Id: I0e5f2d3b29a79a12461dc33c90c812a56810f536

Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
2016-05-20 09:25:14 -07:00
Translation updater bot
b84928c66f Localisation updates from https://translatewiki.net.
Change-Id: I23caefae3374028db6475f66244c1ec3627f49ec
2016-05-19 21:57:18 +02:00
Brad Jorsch
a932d0c429 API: Handle shorthand "all groups" configuration in ApiQuerySiteInfo
In $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, and
$wgGroupsRemoveFromSelf, boolean true in place of an array of groups to
allow adding/removing is shorthand for "all groups". Handle this
appropriately in action=query&meta=siteinfo&siprop=usergroups.

Bug: T135467
Change-Id: I6ae61ef14ac7932e3369155c56bad60a9d72060d
2016-05-19 18:53:57 +00:00
jenkins-bot
cdc53ad15b Merge "API: Avoid duplicate IDs in API documentation" 2016-05-19 17:57:26 +00:00
Translation updater bot
cde7c422dc Localisation updates from https://translatewiki.net.
Change-Id: I8f24e94f2d29d5befd905c8e4cb5fa89002ecd38
2016-05-18 21:53:47 +02:00
addshore
0291f59539 Use WIS::getNotificationTimestampsBatch in ApiSetNotifTimestamp
Bug: T134387
Change-Id: I560ae6a29fa27c1e4f1f62aa647e14542b0cc8a9
2016-05-18 12:09:29 +01:00
addshore
eacec0a223 add setNotificationTimestampsForUser to WatchedItemStore
Bug: T134387
Change-Id: Ia6abe7687b51aabe67e8461375075692db28c9a2
2016-05-18 08:50:46 +00:00
Translation updater bot
c0d0dde351 Localisation updates from https://translatewiki.net.
Change-Id: I170960df4963c50ee00e0f9d3d876061a7f93378
2016-05-17 21:55:54 +02:00
Aaron Schulz
ba6844e21c Improve edit stash hit rate for logged-out users
Check whether they made intervening edits just like logged-in users.

Bug: T134620
Change-Id: Id1e0808caee0e474570c4f2e4b1cf845572e17e0
2016-05-17 19:04:42 +00:00
Fomafix
796d62d034 Language: Introduce new method equals( Language $lang )
Use

 $lang->equals( $wgContLang )

instead of

 $lang->getCode() === $wgContLang->getCode()

Change-Id: Id7ed6a21ce5e2ea2887ec98c7bd9d3eba83d733b
2016-05-16 22:33:33 +00:00
Translation updater bot
eb76695cce Localisation updates from https://translatewiki.net.
Change-Id: I3d5ebd735a385c8b9a6683d996ff54906bece98c
2016-05-16 22:15:59 +02:00
Bartosz Dziewoński
c57fe1c4a8 Refactor upload dialog to make it configurable
This aims to solve all the problems and fulfill all the use cases.
It allows the dialog to be configured for Wikimedia Commons without
hardcoding anything, and it should be flexible enough for third-party
use. The default configuration should be sane for any wiki.

The file upload dialog can be configured using $wgUploadDialog.
See DefaultSettings.php for documentation. Example configuration for
Wikimedia Commons: Id56370e2334c8fe34e88180356232b48c244b7c4.

Configuration is loaded using ResourceLoaderUploadDialogModule for
local uploads or using ApiQuerySiteinfo (action=query&meta=siteinfo)
for uploads to a foreign wiki. Custom localisation messages may be
loaded using action=query&meta=allmessages.

Renamed messages:
  upload-form-label-own-work-message-local       -> upload-form-label-own-work-message-generic-local
  upload-form-label-not-own-work-message-local   -> upload-form-label-not-own-work-message-generic-local
  upload-form-label-not-own-work-local-local     -> upload-form-label-not-own-work-local-generic-local
  upload-form-label-own-work-message-default     -> upload-form-label-own-work-message-generic-foreign
  upload-form-label-not-own-work-message-default -> upload-form-label-not-own-work-message-generic-foreign
  upload-form-label-not-own-work-local-default   -> upload-form-label-not-own-work-local-generic-foreign

Deleted messages, moved to WikimediaMessages in Id2977e19330aeaf854157d4355cd17e5dc72f16a:
  upload-form-label-own-work-message-shared
  upload-form-label-not-own-work-message-shared
  upload-form-label-not-own-work-local-shared

Bug: T118097
Bug: T120998
Bug: T121632
Bug: T121633
Bug: T127895
Change-Id: I3017b8f09c27625deb7a92d6f667895b71cc0637
2016-05-16 21:14:58 +02:00
Brad Jorsch
54d58ef506 API changes for AuthManager
Changes here are:
* action=login is deprecated for use other than bot passwords
* list=users will indicate if a missing user name is creatable.
* Added action=query&meta=authmanagerinfo
* Added action=clientlogin is to be used to log into the main account
* action=createaccount is changed in a non-BC manner
* Added action=linkaccount
* Added action=unlinkaccount
* Added action=changeauthenticationdata
* Added action=removeauthenticationdata
* Added action=resetpassword

Bug: T110276
Bug: T110747
Bug: T110751
Bug: T32788
Bug: T67857
Bug: T28597
Bug: T76103
Change-Id: I244fa9b1e0623247d6d9fa30990411c6df94a496
2016-05-16 15:12:52 +00:00
Translation updater bot
19491986ca Localisation updates from https://translatewiki.net.
Change-Id: Ie62e31d1dfe9cd21d61c3533d9d28929de41f482
2016-05-15 21:52:25 +02:00
Translation updater bot
bd1bddcddd Localisation updates from https://translatewiki.net.
Change-Id: I79cf84152b3696200e8439b31fa851552b687a3a
2016-05-14 22:22:57 +02:00
jenkins-bot
3a75dd1cac Merge "Make "presumed-fresh" edit stash case cover when users make intervening edits" 2016-05-14 00:37:31 +00:00
Roan Kattouw
88657870bf Follow-up 6ce974f: also update the hook call in ApiMain
The fact that ApiMain invokes an OutputPage hook is terrible though.

Change-Id: I76bb9c36ccca365f77c9b7e2a481048da04bd909
2016-05-13 16:01:26 -07:00
Aaron Schulz
2be38b3670 Make "presumed-fresh" edit stash case cover when users make intervening edits
This still handles users editing inclusions themselves, but is
more relaxed in terms of edits by other users to the inclusions.

Bug: T134620
Change-Id: I6c0d189957481dfb6da0e73581b1d5b69fd3a352
2016-05-13 21:20:41 +00:00
MGChecker
6b9619a3a7 Split off permission to delete tags from managechangetags permission
Every permission included in managechangetags is really harmless and can be reverted
in short time, except of the permission to irriversibly delete tags. That's why
this should be excluded in an additional permission that other wikis can restrict
deletechangetags more than other tag management actions.

Bug: T133811
Change-Id: Ieb9199f2c6997316ae3468ff5a92b2d2456c012f
2016-05-12 21:11:04 +00:00
Translation updater bot
8e60e505d0 Localisation updates from https://translatewiki.net.
Change-Id: I96105a757969f20b5ae7449773862dc92fa542cc
2016-05-12 21:52:56 +02:00
Brad Jorsch
f2874e2355 Fix ApiBase::getErrorFromStatus() and ApiMessages
When the code was written, $status->getErrorsArray() would return the
Message objects unchanged. But I0deaa988 broke that and apparently
didn't bother fixing callers.

Now that I'm trying to actually use it for something, I find it's
broken, so I fixed it.

Change-Id: I763729c5bdd63448b50229774ef1f9d12cfb795d
2016-05-11 14:21:08 -04:00
jenkins-bot
452779b824 Merge "Add WebRequest methods for determining "safe" requests" 2016-05-11 11:42:41 +00:00
Translation updater bot
37e7f383df Localisation updates from https://translatewiki.net.
Change-Id: Ic9f08416c57ebe67a3ebdac74c273f2b2a4abd4b
2016-05-10 21:57:33 +02:00
Aaron Schulz
549af8bf91 Add WebRequest methods for determining "safe" requests
* This is useful for logic that decides what DB (master/slave) to use
  based on the nature of the web request. It could also be used to
  enforce clear read/write distinctions via exceptions if DB_MASTER
  is misused.
* Also fixed two IDEA errors while editing this class.

Bug: T134608
Change-Id: I43f4bc06c19d823d7d1ffd9cee8bbe60563c7f82
2016-05-10 11:17:28 -07:00
jenkins-bot
17395ea3d4 Merge "Fix executeTiming statsd metrics" 2016-05-10 12:38:52 +00:00
Translation updater bot
99d593b357 Localisation updates from https://translatewiki.net.
Change-Id: If8a5867fbd9578d5f2f61700177fbe240620b54f
2016-05-08 21:53:34 +02:00
Aaron Schulz
07e23b39a4 Make stashEditFromPreview() call setCacheTime()
This makes sure the output can pass the "presumed fresh" check.

Bug: T134620
Change-Id: I4f9ac2f1b9cef5c6b179946ea02a5e2fad2adc09
2016-05-07 11:02:35 +00:00
Translation updater bot
51d16bb769 Localisation updates from https://translatewiki.net.
Change-Id: I229e2b998e58626f03320c521b286fa5dfbaf9c9
2016-05-07 10:24:33 +02:00
Aaron Schulz
6c3780e1a1 Bump PRESUME_FRESH_TTL_SEC to improve hit rate and avoid link queries
Task: T134620
Change-Id: I3f76d81ee0ff42bbab6a1b000907e80f4533519c
2016-05-07 00:39:45 +00:00
addshore
818984e5cb Remove WatchedItemStore::getDefaultInstance
Change-Id: I0c7d706fabee8d1f6fcfbc4c568f375953de8058
2016-05-06 08:47:37 +00:00
Translation updater bot
d33dce5b65 Localisation updates from https://translatewiki.net.
Change-Id: I0d3a20114f1091e29f46da23be3a1b9906d8196d
2016-05-04 22:00:20 +02:00
jenkins-bot
f47b7d6afc Merge "ApiOptions: set form field parent earlier" 2016-05-04 16:06:56 +00:00
Gergő Tisza
93c5cc236a ApiOptions: set form field parent earlier
Bug: T134351
Change-Id: I44b9bbd1663c876cf0c6160f10badfd8f380656b
2016-05-04 17:09:18 +02:00
jenkins-bot
c09672bb20 Merge "Correct error message for missing permission to get patrol information" 2016-05-03 20:34:48 +00:00
Translation updater bot
34284d0195 Localisation updates from https://translatewiki.net.
Change-Id: Ibee58256489a534f8adf5cd4f3ffc14c85ea197a
2016-05-03 22:00:08 +02:00
Matthias Mullie
ed6a2d5df1 Check if user is blocked during upload process
Further down, this was already somewhat being checked.
On L112, `verifyTitlePermissions` is called, which will fail
if the user is blocked. However:

* This was not being checked during stashed uploads
* Block just "happens" to be part of that check: the intent is
  actually to verify the file title. The error is treated as
  recoverable (the title can be changed), but it isn't (the
  user can't unblock himself in this process)

Bug: T111228
Change-Id: I9cbf250a0b92c3daa3a0843f2257cc049abd3923
2016-05-03 13:23:44 +00:00
MGChecker
6b47262a10 Correct error message for missing permission to get patrol information
Patrolmarks permission is enough to request patrol information, as it's coded
in useRCPatrol() and useNPPatrol().

Change-Id: I4115bdbbcaf6764d71784efe2d8ac63cc77ce770
2016-05-02 22:03:47 +00:00
jenkins-bot
e3c97b32f6 Merge "Set explicit direction to ApiHelp headers with module names" 2016-05-02 16:05:40 +00:00
Fomafix
5233d83202 API: Avoid duplicate IDs in API documentation
With $wgExperimentalHtmlIds = true Sanitizer::escapeId( 'main/credits' )
is equal to 'main/credits'. This generate a duplicate ID.

This change generates the additional <span> only with
$wgExperimentalHtmlIds = false.

Bug: T134155
Change-Id: Ie5d692b7b166030b2bc5c426b44608d981274cd0
2016-05-02 14:09:06 +00:00
Translation updater bot
6f9df79fa0 Localisation updates from https://translatewiki.net.
Change-Id: Ife995ee37ad1b23b10b802d7f765750892558609
2016-05-01 22:54:29 +02:00
Ricordisamoa
e64035522d Fix and standardize Doxygen tags
* Use "@param datatype $paramname description" format

* String → string, Integer → int etc.

* @return $string → @return string

Change-Id: I860d222382cb4c5699d313b0600bd22503c8c385
2016-04-30 12:10:17 +02:00
Aaron Schulz
008a5d7e2c Fix executeTiming statsd metrics
Nothing was being sent out before.

Change-Id: I5d3c681337fc49bd3026781c1bcddf0f2d8e6b8a
2016-04-29 15:47:11 -07:00
Translation updater bot
e7f803b071 Localisation updates from https://translatewiki.net.
Change-Id: I75205fc07e65c44bd543a2fa890c6cca94a21b8e
2016-04-29 22:16:54 +02:00
Amir E. Aharoni
7b76fbfeed Set explicit direction to ApiHelp headers with module names
Bug: T112364
Change-Id: I28e8e0cbbeb0ff0a41a06cb28fbda26d72725e59
2016-04-29 18:06:38 +03:00
Aaron Schulz
af349f79c8 Fix timestamp check in ApiStashEdit::checkCache
* The wrong time method was used, and it also was not set.
* Bumped the threshold a bit while at it, which was basically
  0-5 minutes before.

Bug: T133332
Change-Id: Ide3e66f551aa6e50410c562e5c917141d59b7f64
2016-04-28 22:01:03 +00:00
Translation updater bot
ddde7661a2 Localisation updates from https://translatewiki.net.
Change-Id: I8e0a4883bd78e81a72bfafb8b7813dc45799e0f3
2016-04-27 22:30:11 +02:00
Translation updater bot
da227cffdb Localisation updates from https://translatewiki.net.
Change-Id: Ifece83af145eed33767bd4bc29e373aa00411ae6
2016-04-26 22:01:13 +02:00
Stanislav Malyshev
34b02d87ac Convert SearchEngine to service containers
Change-Id: Icef1ecbed3d831557e0256fdfa53743b194007cc
2016-04-25 16:25:17 -07:00
Translation updater bot
349e851584 Localisation updates from https://translatewiki.net.
Change-Id: Ib552061b1052fae52ba0a3c3cba6dfa6a9f20ea0
2016-04-24 22:04:46 +02:00
jenkins-bot
47e2941bcd Merge "Namespace LinkTarget under MediaWiki\Linker" 2016-04-24 12:31:13 +00:00
Translation updater bot
98df387de3 Localisation updates from https://translatewiki.net.
Change-Id: I08afd3e2ef249cd2392012537592f33703cbfe4d
2016-04-23 21:53:14 +02:00
Translation updater bot
b114e482f0 Localisation updates from https://translatewiki.net.
Change-Id: Idcbc72b595213f1c7637525cfe72eaa88053dd80
2016-04-22 22:05:45 +02:00
Kunal Mehta
c9d885f3b4 Namespace LinkTarget under MediaWiki\Linker
And add a GPL file header while we're at it.

Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
2016-04-21 17:19:10 -07:00
Translation updater bot
88f73a5d65 Localisation updates from https://translatewiki.net.
Change-Id: If37acfa27b8f6648209998996ebef2e8bbe83622
2016-04-21 22:37:42 +02:00
Translation updater bot
7c3a2697d0 Localisation updates from https://translatewiki.net.
Change-Id: I910ce04ca2372c9b7ac534664464b4edca6f759f
2016-04-20 22:41:38 +02:00
Translation updater bot
0c223c1d86 Localisation updates from https://translatewiki.net.
Change-Id: I945074db5ba068c8e6b49b0cef3990938e766f16
2016-04-19 21:59:09 +02:00
Ori Livneh
0f1ffa4da7 Segment stash edit cache stats by basis for hit/miss
Instead of just counting cache hits and misses, segment the counts by reason,
so we can differentiate (for example) timestamp-based cache hits from
staleness-check-survivor cache hits. I want this data so I can determine
whether increasing the cutoff for timestamp-based hits from 3 to 5 seconds has
a substantial enough impact to warrant the slightly weaker consistency.

Also changed 'cache-hit' to 'cache_hit'. MediaWiki normalizes the dash to an
underscore anyway, but the normalization is there for dynamically-constructed
key names (or name segments). In the case of hard-coded values, it is desirable
for the code to be as close as possible to the final form of the metric name,
to simplify metric lookup.

Change-Id: I0cd61da9746e3ca3695e23200f698b8b1371798c
2016-04-19 01:31:39 +00:00
Translation updater bot
4dcd58d3db Localisation updates from https://translatewiki.net.
Change-Id: I3777ce409669883f0d7ac20ce834bf8526b6dfea
2016-04-18 21:59:44 +02:00
jenkins-bot
e8dd1bce3f Merge "Reject usernames with # as user-type API parameters" 2016-04-18 15:16:58 +00:00
jenkins-bot
34cef58973 Merge "API: Allow subclassing ApiQueryImageInfo" 2016-04-18 07:30:37 +00:00
Derk-Jan Hartman
6e74735369 API: Allow subclassing ApiQueryImageInfo
execute() references the static self::getInfo, which therefor cannot be
overriden by the subclass ApiQueryVideoInfo. Preferably, we'd fix the
implementation to not require this subclassing, but this will make
that transition easier. Use late static binding to make sure the
subclass implementation can be used.

Change-Id: Iab2d01abb9f9b3b799123d8ee344ea139e476576
2016-04-17 22:02:20 +02:00
Translation updater bot
61bfc4ca7a Localisation updates from https://translatewiki.net.
Change-Id: I862b3058c7538e56264257b44bc0b0bff04f1da0
2016-04-16 22:43:27 +02:00
Gergő Tisza
db8b70fb31 Reject usernames with # as user-type API parameters
Th API handles parameters of type 'user' as page titles, which resulted
in silently dropping # characters and anything following them.
Reject such usernames explicitly instead.

Bug: T132852
Change-Id: Iba8061b20d5e25de80ff30d09eb53939c97cdaac
2016-04-16 17:45:39 +00:00
jenkins-bot
8cb8af442a Merge "Use english messages for background use of Status::getWikiText" 2016-04-13 14:03:56 +00:00
Max Semenik
ff4a3287db Switch to external HtmlFormatter
wikimedia/html-formatter is already present in mediawiki/vendor
as of 3954ca36ce3cbedc76c1763ad2694320c1327ce6.

Bug: T125001
Change-Id: Ie98096e5e3d325cde583bc66b21b8b41f2bba8b2
2016-04-13 02:37:59 +00:00
Translation updater bot
6d0dfac93c Localisation updates from https://translatewiki.net.
Change-Id: I95fb9e364f3268eddab39b9abe4c68c62a1ec11a
2016-04-12 22:15:08 +02:00
umherirrender
932c37e3cb Use english messages for background use of Status::getWikiText
Status::getWikiText is used for internal logging, api error messages and
maintenance scripts. All this places are usually in english, so pass an
english language to getWikiText.

Change-Id: I3010fca8eb5740a3a851c55a8b12e171714c78f7
2016-04-12 20:01:44 +02:00
jenkins-bot
cc28eaeb09 Merge "Add preference for watching uploaded files" 2016-04-12 17:29:29 +00:00
Translation updater bot
e84bce4fb8 Localisation updates from https://translatewiki.net.
Change-Id: I065f082606ccb1d6df353f503ee8f393d8d6466b
2016-04-11 21:57:01 +02:00
Translation updater bot
9098802ae3 Localisation updates from https://translatewiki.net.
Change-Id: I01a967bb1fc77fa9a4f8dd9c8bab4e238b682cd5
2016-04-10 19:14:49 +02:00
Mark Holmquist
785d472559 Add preference for watching uploaded files
Adds a preference in the Watchlist section for watching uploaded files
for an account. Also works from API-based upload methods, so
UploadWizard and other tools should work fine.

Bug: T33313
Change-Id: If962e667de12b35904b2d1b2d9e99c26b588ec2a
2016-04-08 15:21:17 -05:00
Translation updater bot
a8602d862c Localisation updates from https://translatewiki.net.
Change-Id: I3bd0664b4ce71182be57e062204c0ae039fd8f84
2016-04-08 22:01:29 +02:00
jenkins-bot
6bcdf27c74 Merge "Change \\ to \ in phpdoc" 2016-04-08 18:12:54 +00:00
Gergő Tisza
4085db348e Change \\ to \ in phpdoc
Remove "\\" in namespacing. This is a Doxygen compatibility hack but
does not seem needed anymore, Doxygen reads namespaced class names
correctly, see e.g. https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1Services_1_1ServiceContainer.html

PHP IDEs, on the other hand, were broken by the double backslash.

As an unrelated small doc fix, add parameter docs to PermissionError
constructor (parent has different arguments so the inherited
documentation is wrong).

Change-Id: I6da0f512b8c84f65fd20e90e4617108fe6a8fcd2
2016-04-08 17:46:30 +00:00
Translation updater bot
a0e2f5e403 Localisation updates from https://translatewiki.net.
Change-Id: Ib3d0e6a16e61f0443aaa7e929d8bf66c45f5d4df
2016-04-07 22:32:53 +02:00
Translation updater bot
29d80335f9 Localisation updates from https://translatewiki.net.
Change-Id: I1d8329f703a364fbe36a51994cdc0467cdd40387
2016-04-06 22:35:08 +02:00
Translation updater bot
53727a0391 Localisation updates from https://translatewiki.net.
Change-Id: I17458dc07e3b940238dc2395e2fcc08833e303ab
2016-04-05 22:10:22 +02:00
Translation updater bot
84abebcd93 Localisation updates from https://translatewiki.net.
Change-Id: If37db4144db777658d3d2f3aa6bd140469a2547e
2016-04-04 21:53:49 +02:00
Translation updater bot
4f3379d478 Localisation updates from https://translatewiki.net.
Change-Id: I439795a989a00d5b9490514169ee46de7601067e
2016-04-03 22:48:49 +02:00
jenkins-bot
f7d7aa01ab Merge "Update IP address related message text" 2016-04-03 06:26:52 +00:00
IoannisKydonis
4adb40a797 Reword and clarify API messages
Threads:
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Apihelp-upload-param-leavemessage/uk
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Apihelp-main-param-maxlag/ksh
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Apihelp-import-param-summary/en

Change-Id: I71404b96fe48fed62b50ff2f544da97bd925e9d7
2016-04-02 21:49:06 +02:00
Siebrand Mazeland
11d1a56b98 Update IP address related message text
Follow-up to Change-Id: I02fecf0b9e6a5b90f7a24209c7a1cdce64060b23

Change-Id: I36a99f21b4269af0799ce73faee7e19865c5f22f
2016-04-02 21:14:29 +02:00
Siebrand Mazeland
336ab226cc Use IP address range instead of IP range
We use "IP address" consistently instead of "IP", but this was never
applied to the "range" addition.

Change-Id: I02fecf0b9e6a5b90f7a24209c7a1cdce64060b23
2016-04-02 19:29:44 +02:00
Translation updater bot
6add84830c Merge "Localisation updates from https://translatewiki.net." 2016-04-01 20:09:37 +00:00
Translation updater bot
2cd31f2660 Localisation updates from https://translatewiki.net.
Change-Id: Ie0a08fde2970106bae564551bb6ed6bd76f8a9da
2016-04-01 21:58:59 +02:00
Reedy
38d63a73a1 ApiPageSet::finishPageSetGeneration() was removed
Bug:T122754
Change-Id: I106f37f5f83e30222a602d88704069ceccc91a29
2016-04-01 19:58:26 +00:00
Reedy
9593b60855 Removed ApiMain::(getFormats|addFormat|addModule|getShowVersions).
Deprecated since 1.21

Bug: T122754
Change-Id: Id5cbc50e45cdfdfeb2e92faffc7ded868a350f4b
2016-04-01 19:41:48 +00:00
Translation updater bot
e97d3c7478 Localisation updates from https://translatewiki.net.
Change-Id: I5b6a5a944e62e3bb64fd1fdbb3fb654bd0726285
2016-03-31 21:54:54 +02:00
Aaron Schulz
39c4d09727 Time POST requests to API write modules
This lets us capture some basic endpoint timing data that is
lacking now, such as upload API call time.

Change-Id: If0627e2d78d82b22ed6bdaaa0fa7fe5f20ef50b1
2016-03-31 10:05:07 +00:00
Translation updater bot
9496297a0e Localisation updates from https://translatewiki.net.
Change-Id: I4768f539d408562cd0b37e083a0500a99c7c66a2
2016-03-30 22:01:05 +02:00
Translation updater bot
a8e00b6fe6 Localisation updates from https://translatewiki.net.
Change-Id: I807d9f22094274e39b0d9e524bd58bc9f46e5234
2016-03-29 22:08:24 +02:00
Translation updater bot
cd2b282b79 Localisation updates from https://translatewiki.net.
Change-Id: I2b5d9392619b4eec5a266f9828ee4a1f09579488
2016-03-28 21:51:27 +02:00
Bartosz Dziewoński
771964fdea ApiMain: Correct typo in variable name
https://en.wikipedia.org/wiki/Asterisk

Change-Id: I6f2d968c92f4e472fe574ebc8a2a5f9932e0d6f2
2016-03-28 16:45:02 +00:00
jenkins-bot
4a33b34696 Merge "API: Normalize input URL in ApiQueryExtLinksUsage" 2016-03-28 02:27:29 +00:00
Translation updater bot
ace407e276 Localisation updates from https://translatewiki.net.
Change-Id: I977112d0c7c10d043c8f71ace015cf0d97e373f3
2016-03-27 20:29:34 +02:00
Brad Jorsch
a2f2cf8cf1 API: Normalize input URL in ApiQueryExtLinksUsage
This matches the behavior of Special:LinkSearch, and makes it more
likely to give sensible results for non-normalized input.

Bug: T130912
Change-Id: I2f60dd48fdfc24108110a24ad41b297ece7f33df
2016-03-26 18:14:43 -04:00
Ori Livneh
5360a3497f Provide a unique request identifier
When MediaWiki encounters an unhandled exception, the error message it produces
includes a randomly-generated token, which allows the exception details to be
looked up in the error logs. This is useful but narrow: would it not be useful
to have the ability to retrieve all log records associated with a particular
request, rather than just exception details? (Hint: yes.)

So: introduce the notion of a request-global unique ID, retrievable via
WebRequest::getRequestId(). When MediaWiki is behind Apache + mod_unique_id
(which provides the same facility) or some other software which sets a
UNIQUE_ID envvar, the value of that envvar is used as the request ID.
Otherwise, it is a randomly-generated 24-character string.

The request ID supplants exception-specific IDs; MWExceptionHandler::getLogId()
is deprecated, accordingly. The request ID is also added as an annotation to
all Monolog-processed log records, and is exposed client-side as 'wgRequestId'.
This allows developers to associate a page view with log records even when the
page view does not result in an unhandled exception. (For the WMF, I also
intend to add it as an annotation to profiling data).

The request ID is not a tracking token; it does not persist, and it is
associated with a backend request, not with a particular user or a particular
session. Like the data in the NewPP report, the request ID is designed to be
cacheable, so that if, for example, a developer notices something weird in the
HTML, s/he can associate the output with a backend request regardless of
whether the response was served from the cache or directly from the backend.

Some prior art:
* https://httpd.apache.org/docs/2.4/mod/mod_unique_id.html
* http://api.rubyonrails.org/classes/ActionDispatch/RequestId.html
* https://github.com/dabapps/django-log-request-id
* https://packagist.org/packages/php-middleware/request-id
* https://github.com/rhyselsmore/flask-request-id

Change-Id: Iaf90c20c330e0470b9b98627a0228cadefd301d1
2016-03-25 16:09:05 +00:00
Translation updater bot
855dfc341d Localisation updates from https://translatewiki.net.
Change-Id: I31cbae4f585f73a2a0ab97909206185a0d1c0aef
2016-03-24 22:09:30 +01:00
Ricordisamoa
1617e7822e Always use 'bool' instead of 'boolean' in Doxygen tags
Just like commit f86a5590aa

Change-Id: Ic9d08bca6524d6bb4baf5170c081ad0f3d738e28
2016-03-24 09:44:09 +01:00
Translation updater bot
fa9b2e6d02 Localisation updates from https://translatewiki.net.
Change-Id: Idf395e9379605a64103df4ee0ce3847b600f5ede
2016-03-23 21:54:56 +01:00
Translation updater bot
f62f84f175 Localisation updates from https://translatewiki.net.
Change-Id: Iba1610b61c1658b22216e57ed5d60d131073feab
2016-03-22 22:00:03 +01:00
Translation updater bot
9478a1db8a Localisation updates from https://translatewiki.net.
Change-Id: I9e4277291fc529f86496f46c8eab1c2cd4590903
2016-03-21 23:00:56 +01:00
jenkins-bot
f9128d21b7 Merge "Use WatchedItemStore in ApiQueryInfo::getWatchedInfo" 2016-03-21 10:24:09 +00:00
Leszek Manicki
b92ae1501e Use WatchedItemStore in ApiQueryInfo::getWatchedInfo
Adds a method for getting watchlist's notification timestamps
for a batch of LinkTargets.

Bug: T129482
Change-Id: I1f84212e7879a84b34bb3b53859069fcea282bba
2016-03-21 10:25:54 +01:00
Translation updater bot
848cf81714 Localisation updates from https://translatewiki.net.
Change-Id: I3d9b14ae3a5d77fea9694ef113b0180e5677c39e
2016-03-20 22:15:07 +01:00
Translation updater bot
f2a160f777 Localisation updates from https://translatewiki.net.
Change-Id: I67c4a49a16f5cee599db767b1414cac75bc19fd5
2016-03-19 22:10:06 +01:00
jenkins-bot
ecfdb46916 Merge "API: Allow fetching login token from action=query&meta=tokens on private wikis" 2016-03-18 22:19:25 +00:00
Brad Jorsch
02cc80c514 API: Allow fetching login token from action=query&meta=tokens on private wikis
The problem is that ApiQuery requires the 'read' right even though
ApiQueryTokens doesn't.

So, we introduce an exception: if action=query gets only meta=tokens
(and optionally rawcontinue and indexpageids, since they don't affect
anything), no other modules and nothing in the ApiPageSet,
ApiQuery::isReadMode() will return false.

Bug: T130112
Change-Id: I83dafb0305ff0cb1fc3bac668b88b5d2022e5880
2016-03-18 17:11:40 -04:00
Translation updater bot
6011e78ab0 Localisation updates from https://translatewiki.net.
Change-Id: I935a1d0bbc9fa5028f2fa1c9b05272ec2e416a7a
2016-03-18 21:57:36 +01:00
jenkins-bot
53c469e0b4 Merge "ApiQueryStashImageInfo: Don't throw exceptions when the user is not logged in" 2016-03-18 18:19:46 +00:00
Bartosz Dziewoński
18e68d62da ApiQueryStashImageInfo: Don't throw exceptions when the user is not logged in
Bug: T130253
Change-Id: If70b919c65a21b57b3022d495756bf250b0ba786
2016-03-18 16:22:58 +01:00
Bryan Davis
96d6cb6e16 Rename ApiRequest to ApiAction
Half of the work needed for handling this logging stream was done using
the channel name "ApiRequest" and the other half was done under the name
"ApiAction". The ApiRequest naming is easier to change at this point.

Bug: T108618
Change-Id: I5797731abeba22ef6ced7c8407ee670344d35b3d
2016-03-17 16:43:50 -06:00
Bryan Davis
84e8829687 Cast API timeSpentBackend to an int
Fixes {"timeSpentBackend":"Expected integer, but received double"} Avro
encoding error.

Bug: T108618
Change-Id: Iea79d14afe0ef0d1a9ea88096b7bbd90083df757
2016-03-17 22:21:36 +00:00
Translation updater bot
d79c3b36b9 Localisation updates from https://translatewiki.net.
Change-Id: I610b8736afb5cc84d6a057c521a241c3656b73b8
2016-03-17 22:37:47 +01:00
Leszek Manicki
7d4e225cb9 Add WatchedItemStore::countVisitingWatchersMultiple
This is for batch counting of visiting watchers, following the change
made in I2868c31fc09121de381d822e8f49194e3022bb42.
Query/logic has been extracted from ApiQueryInfo.

Bug: T129482
Change-Id: Ia9a534f5edb7af3cb7bf86be358dddb5d8c259cf
2016-03-17 16:17:38 +00:00
Leszek Manicki
4ec20438ab Fix ApiQueryInfo response for prop=watchers
Ie84e6feaa42db1bc7a1f89b56aed37dd7fe95ea4 part of them problem
with incorrect API response but if when no watchers data is
fetched (ie. due to early return in ApiQueryInfo::getWatcherInfo),
response contains "watchers": null instead of skipping "watchers"
key entirely.

Bug: T129482
Change-Id: I9cab120ec4e6a9cf4626678e45ef14ea8efc8cbc
2016-03-17 09:48:30 +00:00
Translation updater bot
078339b885 Localisation updates from https://translatewiki.net.
Change-Id: I2cd76699393ba63879babd31f435387593d3a2aa
2016-03-16 21:56:35 +01:00
Aaron Schulz
e052761ca0 Add RecursiveLinkPurge log for API requests
Change-Id: I29636c045f7b561b2da0100f5e69050808d1aec7
2016-03-15 21:39:40 +00:00
Translation updater bot
953932c621 Localisation updates from https://translatewiki.net.
Change-Id: I4830f0116910a4e4bddfd7b0d44e7caea70f1f5c
2016-03-15 22:17:29 +01:00
addshore
2bfdb5da84 Fix ApiQueryInfo break from use of WatchedItemStore
Fixes an issue introduced in:
I5a465773599cce9f8c9e94847cede6d12282c827

The new code now returns all targets even when 0
watcher have been found.
This patch adjusts the api to expect that.

Bug: T129482
Change-Id: Ie84e6feaa42db1bc7a1f89b56aed37dd7fe95ea4
2016-03-15 16:08:45 +00:00
jenkins-bot
1ed1cc8769 Merge "Add countUnreadNotifications to WatchedItemStore" 2016-03-15 15:29:59 +00:00
jenkins-bot
198cd73853 Merge "Move counting of watchers to WatchedItemStore" 2016-03-15 15:29:19 +00:00
addshore
846d373c28 Add countUnreadNotifications to WatchedItemStore
This query / logic has been extracted from
ApiQueryUserInfo.

Unit & Integration tests have also been added.

Relating to the task linked this is the last change
needed in this ApiQueryUserInfo!

Bug: T129482
Change-Id: I91aa109416c16cd1f257c9de46669e35d6fd34d7
2016-03-14 16:00:47 +00:00
addshore
6e2d6a0b44 Move counting of watchers to WatchedItemStore
Also adds tests

Bug: T129479
Bug: T129482
Change-Id: I5a465773599cce9f8c9e94847cede6d12282c827
2016-03-14 15:56:16 +00:00
Translation updater bot
b598347d56 Localisation updates from https://translatewiki.net.
Change-Id: I8af274b32e9af1553e074c4b29eedd0f7f3803eb
2016-03-12 20:50:54 +01:00
Translation updater bot
55132619eb Localisation updates from https://translatewiki.net.
Change-Id: Ie105d1bced55a141d9c641ab0c6cec53e267d427
2016-03-11 21:55:12 +01:00
jenkins-bot
c5f4cd0ad1 Merge "Remove some deprecated functions from ApiBase" 2016-03-10 21:22:30 +00:00
Translation updater bot
b35d903366 Localisation updates from https://translatewiki.net.
Change-Id: Iaea8b19d6e8c2cb24cb41c36f42c833c8cadf85a
2016-03-10 21:54:09 +01:00
Siebrand Mazeland
19316dd4e4 Remove some deprecated functions from ApiBase
* ApiBase::addTokenProperties() was removed (deprecated since 1.24).
* ApiBase::getFinalPossibleErrors() was removed (deprecated since 1.24).
* ApiBase::getFinalResultProperties() was removed (deprecated since 1.24).
* ApiBase::getRequireAtLeastOneParameterErrorMessages() was removed (deprecated since 1.24).
* ApiBase::getPossibleErrors() was removed (deprecated since 1.24).
* ApiBase::getRequireMaxOneParameterErrorMessages() was removed (deprecated since 1.24).
* ApiBase::getRequireOnlyOneParameterErrorMessages() was removed (deprecated since 1.24).
* ApiBase::getResultProperties() was removed (deprecated since 1.24).
* ApiBase::getTitleOrPageIdErrorMessage() was removed (deprecated since 1.24).
* ApiBase::parseErrors() was removed (deprecated since 1.24).
* Remove related constants ApiBase::PROP_ROOT, ApiBase::PROP_LIST,
  ApiBase::PROP_TYPE, ApiBase::PROP_NULLABLE.

Patches were submitted for remaining uses in Gerrit extensions.

Change-Id: Idea70300874258fbcb9deef6504eb55f2ebe8d6c
2016-03-10 21:45:04 +01:00
Translation updater bot
3565fe0795 Localisation updates from https://translatewiki.net.
Change-Id: Ifd102e2f148caf1caea83af03b8e42eff8ff72cc
2016-03-09 21:57:31 +01:00
Translation updater bot
8228f3532b Localisation updates from https://translatewiki.net.
Change-Id: I4d6429a915ca693c26bdce85c0fc70ffab7af876
2016-03-08 22:01:34 +01:00
Siebrand Mazeland
5b119a0e44 Replace uses of join() by implode()
All of core uses implode() consistently now.

Change-Id: Iba50898c64c43f356d1caf8869f484e90d9ff651
2016-03-08 18:24:16 +00:00
jenkins-bot
2295a850be Merge "Move WatchedItem logic to WatchedItemStore" 2016-03-08 18:04:11 +00:00
jenkins-bot
2aff530dfb Merge "Use single quotes in API where possible" 2016-03-08 17:03:24 +00:00
Siebrand Mazeland
bc0ae710e3 Use single quotes in API where possible
Change-Id: I972e296f4820f78f5dfcecc27bc4912ca84a3178
2016-03-08 17:27:00 +01:00
Siebrand Mazeland
e5b5fe7ba3 Declare functions with access modifiers
Parents have this visibility.

Change-Id: Icb4d0a112def0ac02f9aa42723c81bc63c085450
2016-03-08 16:16:33 +00:00
Siebrand Mazeland
5433a5e998 Explicitly declare ApiQueryImageInfo::getInfo() public
Used as such in core and TimedMediaHandler.

Change-Id: I0ec90d2cf9ae4cca31e93522e0f68e4d55a7bcfe
2016-03-08 16:16:13 +00:00
Siebrand Mazeland
24a4484ec4 Remove deprecated methods in ApiQuery
No more uses found in core or Gerrit extensions for the following methods:

* ApiQuery::getGenerators() was removed (deprecated since 1.21).
* ApiQuery::getModuleType() was removed (deprecated since 1.21).
* ApiQuery::setGeneratorContinue() was removed (deprecated since 1.24).

Change-Id: I1d46adc9ecad598c7d7726a2243bba4f7a04531a
2016-03-08 16:15:26 +00:00
Siebrand Mazeland
d4eb4a7e5c Explicitly declare ApiImport::getData() public
Used as such in this file.

Change-Id: I52cae5763132b606f0e4b67f1359baee9fdad1c8
2016-03-08 16:14:22 +00:00
Siebrand Mazeland
ff6ad78546 Explicitly declare ImportReporter::reportPage() and override public
Used as such in SpecialImport.php.

Change-Id: Ia8cb1f4b95f43a50ff7ddd9aa4cb3ffc90f916c8
2016-03-08 16:13:36 +00:00
Siebrand Mazeland
7489b1e8df Explicitly declare ApiFormatXml::addXslt() protected
Only used in private/protected context.

Change-Id: Ic44d6e70e89c3d229d79aa08d2a0092609e7d62e
2016-03-08 16:12:26 +00:00
Siebrand Mazeland
3bb675b164 Explicitly declare ApiFormatBase::initPrinter public
It's overridden three times, and in all cases it's public.

Change-Id: I1712319076b38bbb5418c60b954e174354831be3
2016-03-08 16:11:31 +00:00
Siebrand Mazeland
8a02a4b4fd Call static functions statically in API
Change-Id: I5952acb932c1e7337dc85226a898da3472e799e9
2016-03-08 16:11:02 +00:00
Siebrand Mazeland
33ba3bea02 Use Elvis operator where possible in API
Change-Id: I0a26c04cf2ded2c1bd74d8dabd131ae8e20117f3
2016-03-08 16:10:23 +00:00
Siebrand Mazeland
94afc567d6 Remove unused local variables in API
Change-Id: Ia94ae232308ad47ee88dbd30675cfcbdb6b371ed
2016-03-08 16:52:00 +01:00
addshore
fee0afdc8a Move WatchedItem logic to WatchedItemStore
This also removes assumptions that when a page
in one Namespace should be watched / removed
that the page in the talk / subject ns for the
page should have the same action applied

This should maintain all backward compatability
for the WatchedItem class

This also includes tests written by:
 - WMDE-leszek
 - Addshore

Bug: T127956
Change-Id: Iad9abafe4417bb479151a3bfbee6e1c78a3afe3c
2016-03-08 15:41:22 +00:00
Translation updater bot
adaf3d221f Localisation updates from https://translatewiki.net.
Change-Id: I11fb4866b2fc0c5daf9ee639d42feef2cdafe768
2016-03-07 21:59:57 +01:00
Translation updater bot
ee683c821e Localisation updates from https://translatewiki.net.
Change-Id: I683765945022afc8b9b4a839ab28f47f79d86f69
2016-03-06 21:51:01 +01:00
Translation updater bot
7ab19abd82 Localisation updates from https://translatewiki.net.
Change-Id: Ib49bf89dcc309086e521635db1198fe39e46b995
2016-03-05 22:41:56 +01:00
Translation updater bot
0fcde80db7 Localisation updates from https://translatewiki.net.
Change-Id: I62572d292497e21e7ffcaf6b8ab2524f469360a6
2016-03-04 22:11:18 +01:00
jenkins-bot
996b7350f3 Merge "Add tags support to patrol, protect, unblock, and undelete" 2016-03-03 16:28:45 +00:00
Timo Tijhof
ee1d97b3cc api: Fix "PHP Notice: Undefined variable: config"
Follows-up 362c220aa1, which split the method up but didn't
re-create a local $config variable.

Change-Id: Ic32ac3c600d0b4d69e8129fa50ea47d9a6a54b20
2016-03-02 21:54:43 +00:00
jenkins-bot
d86fd79066 Merge "Convert remaining array() to [] in API" 2016-03-02 02:27:58 +00:00
Translation updater bot
ee96182185 Localisation updates from https://translatewiki.net.
Change-Id: I7c15b259b0f88dbc05ce1520ecb319a66eed6f73
2016-03-01 21:18:57 +01:00
jenkins-bot
d5a36875a7 Merge "Allow API action=logout with BotPasswords" 2016-03-01 11:12:20 +00:00
Brad Jorsch
00658d6800 Allow API action=logout with BotPasswords
Since login is handled specially, do the same for logout.

Bug: T128335
Change-Id: Ib3b12d7045449b5c44f5ff7d1ecfce14416e8400
2016-03-01 02:26:45 +00:00
Reedy
9b91df2d48 Convert remaining array() to [] in API
Change-Id: Ib44d59ff0cf0d6d8efc462671cac716dbead8ffc
2016-02-29 22:51:36 +00:00
Geoffrey Mon
e70c4eb664 Add tags support to patrol, protect, unblock, and undelete
- Add 'tags' parameters to appropriate API modules
- Add tag-adding logic to appropriate functions that carry out
  relevant functions
- ManualLogEntry::{set,get}Tags to handle adding tags to log
  entries in a cleaner fashion
- Use ManualLogEntry::setTags in LocalFile::recordUpload2

Bug: T97720
Change-Id: I98c52da7985623bfdafda2dc2dae937b39b72419
2016-02-29 16:59:31 -05:00
Translation updater bot
ba9333f79f Localisation updates from https://translatewiki.net.
Change-Id: I5da9bd040f15c0ded7c5b507c36f6d31a1dd049a
2016-02-29 22:28:03 +01:00
jenkins-bot
310cdcd39a Merge "Add request error state to ApiBase::logRequest" 2016-02-29 16:49:00 +00:00
jenkins-bot
4d9803dcbf Merge "Update ApiAction logging channel values" 2016-02-29 16:41:08 +00:00
Bartosz Dziewoński
c161c46d26 Improve code suffering from PHP 5.3's lack of support for foo()[]
I searched for /\$(\S+) = (.+?\(.*?\);)\n.*?\$\1\[/, ignored
everything involving isset(), unset() or array assigments, then
skimmed through the remaining results and changed things where they
made sense. These changes were not automated, so please review them.

Change-Id: Ib37b4c66fc57648470f151ad412210b3629c2538
2016-02-28 22:49:20 +01:00
Translation updater bot
6f594c4202 Localisation updates from https://translatewiki.net.
Change-Id: I17a79c788bb4cb2c4674bb8f82e723d90ef62d29
2016-02-27 21:21:37 +01:00
jenkins-bot
4772f4452a Merge "Allow more fine-grained throttling of login attempts" 2016-02-26 22:40:15 +00:00
jenkins-bot
34610b59ed Merge "ApiQuerySearch: Match limits to those in Special:Search" 2016-02-26 09:45:23 +00:00
Translation updater bot
d23c47331d Localisation updates from https://translatewiki.net.
Change-Id: I0aad8636bb230609aa260cdbebe7d10114c2236b
2016-02-25 21:50:50 +01:00
Brad Jorsch
ce3d55d6b7 ApiQuerySearch: Match limits to those in Special:Search
The limits were decreased in r55615, but no one seems to remember why.

Bug: T119189
Change-Id: I622203195ed5dbed9548bb4a9a6acdab8e3bc3ed
2016-02-24 16:22:39 -05:00
Brian Wolff
6fcfa98154 Allow more fine-grained throttling of login attempts
In addition to the 5 attempts every 5 minutes rule, add some long
term rules. Its extraordinarily unlikely that a non-malicious person would
use the wrong password 150 times in a row, so add a rule that you
can't have 150 login fails in a row in 48 hours all from the same
IP address. Also add the ability to set throttles across all IPs, but
do not set any of these types by default (There is an unclear risk/benefit
tradeoff between making it easy to lock someone out of their
account in a DoS attack, and preventing brute-forcing)

Bug: T122164
Change-Id: I5c279906936ef3991a42fc21325c3ffd4a200493
2016-02-23 18:02:35 -05:00
Translation updater bot
d651abc99d Localisation updates from https://translatewiki.net.
Change-Id: I2d18d11d274f565e92623563b5f0550a5ed527c1
2016-02-22 21:24:10 +01:00
Reedy
95b2be3bd3 Fix function call casing
Change-Id: I20600c865b9f239ac281a1f8c5776ad4dbec4359
2016-02-22 18:30:33 +00:00
jenkins-bot
62ec66bb11 Merge "Use hex2bin() instead of pack()" 2016-02-22 17:18:00 +00:00
jenkins-bot
a103e82647 Merge "Remove some unused variables" 2016-02-22 17:03:23 +00:00
Translation updater bot
222814598b Localisation updates from https://translatewiki.net.
Change-Id: I9d1b78ddb3fa02956e4b01c137691cf6f290b958
2016-02-21 21:57:15 +01:00
Translation updater bot
3a595014a7 Localisation updates from https://translatewiki.net.
Change-Id: I80bb2ffabf103ac061320924ff1bee7f6c13769c
2016-02-20 21:46:29 +01:00
Reedy
f8a58fa67e Remove some unused variables
Change-Id: Ia3a290555f06c564c063591710380367a04cb1cc
2016-02-20 20:22:56 +00:00
Kevin Israel
6492c009ef Use hex2bin() instead of pack()
This function was added in PHP 5.4.0 and can be used now that MediaWiki
only works with PHP 5.5.9 or higher.

Also fixed a bug in ApiQueryCategoryMembers::validateHexSortkey() that
allowed a single line feed at the end of the string to pass.

Change-Id: I5b577e7dcc5fb6a06ab550429aae657dbcc79083
2016-02-20 00:27:24 -05:00