Commit graph

6443 commits

Author SHA1 Message Date
jenkins-bot
091a882b77 Merge "Avoid master connections for prop=info and intestactionsdetail=full" 2020-01-07 20:56:02 +00:00
jenkins-bot
40576f59dd Merge "Sort user groups when shown in drop-downs" 2020-01-07 00:01:46 +00:00
jenkins-bot
b19a78a6c8 Merge "Add @phan-assert-false-condition to ApiBase::dieContinueUsageIf" 2020-01-06 10:39:13 +00:00
Translation updater bot
b49062f230 Localisation updates from https://translatewiki.net.
Change-Id: I458e42732c4bc50494aed763b6838ddb03e51227
2020-01-02 08:21:46 +01:00
jenkins-bot
cf92c2dc44 Merge "Use namespaced IPUtils class" 2020-01-01 23:56:22 +00:00
jenkins-bot
74aee4ed08 Merge "Use wikimedia/ip-utils 1.0.0 to replace IP class" 2020-01-01 23:55:38 +00:00
Kunal Mehta
99007e96c7 Use namespaced IPUtils class
Change-Id: I047e099a93203a59093946d336a143d899d0271f
2020-01-01 02:36:49 -08:00
James D. Forrester
610954eda6 Use wikimedia/ip-utils 1.0.0 to replace IP class
Adjust use in ApiBase.

Depends-On: I9a172b2bd922c3a62248545906bd9bdfcac03a43
Change-Id: Ie5485b1df9f3886add943ddcf8b0824e87a7f3e4
2020-01-01 02:29:11 -08:00
Daimona Eaytoy
dbf0990447 Avoid PHP scalar type juggling in includes/ (part 2)
Continuation of e5444ea55a.

Change-Id: I9f95e7de4e219dee3abcdd210bb708d949f378d0
2019-12-30 20:57:18 +00:00
jenkins-bot
ec52fd8d7c Merge "Allow null on ApiQueryBase::addTimestampWhereRange" 2019-12-29 20:01:40 +00:00
Thiemo Kreuz
c21b978408 api: Fix incomplete PHPDoc block in ApiBlockInfoTrait
The @see points to a totally different class – which is fine. But no
tool knows it is supposed to inherit the @return type from there.

Change-Id: I40cd0f329980553b7b5f03e8539ee80ca5f032b3
2019-12-29 11:40:01 +00:00
Translation updater bot
74c325e7c5 Localisation updates from https://translatewiki.net.
Change-Id: Ia9fc22a2e83f96eeb7255a73e42604c03a8c6a5d
2019-12-29 09:39:18 +01:00
Umherirrender
3ec00a7405 Allow null on ApiQueryBase::addTimestampWhereRange
Also add null to the underlying functions used here

Change-Id: I2e45fa449cf4c82d9a0e4323c4ac3ac2155bcadc
2019-12-28 22:20:48 +01:00
Translation updater bot
ad5de06421 Localisation updates from https://translatewiki.net.
Change-Id: Id91c9511e284fd3d1565b6bd752df9a9fa393bd8
2019-12-26 14:52:08 +01:00
jenkins-bot
c07ccc4fd3 Merge "ApiParse: Fix handling of pageid + redirects when passed a non-redirect" 2019-12-26 08:21:48 +00:00
Translation updater bot
5d0f3b1821 Localisation updates from https://translatewiki.net.
Change-Id: I30412a5f3948db301a86f63149d6c4beb93e80c4
2019-12-24 09:03:52 +01:00
Brad Jorsch
a2d2ccc8c5 ApiParse: Fix handling of pageid + redirects when passed a non-redirect
The setting of $pageParams in that code path was assuming the page was
specified by title, breaking when it was passed a pageid.

Bug: T241362
Change-Id: Ia5b34ee392c94e5ae7693e95b58806c1dac2b24e
2019-12-23 09:24:17 -05:00
Umherirrender
7dffd6a064 Add @phan-assert-false-condition to ApiBase::dieContinueUsageIf
@phan-assert-false-condition $x will make Phan infer that the argument
to parameter $x is falsey if the function returned successfully.

Change-Id: I928474e922980b2759fcc4252b1df21164297e0a
2019-12-22 22:58:16 +01:00
Translation updater bot
1521e3aafe Localisation updates from https://translatewiki.net.
Change-Id: Ic957e13b27f76976c2036abd6172a4bae2dea05a
2019-12-22 16:35:39 +01:00
Translation updater bot
2c3e8709c8 Localisation updates from https://translatewiki.net.
Change-Id: I169d57ca62250b81913c4e26f0fe00b15178c18a
2019-12-18 08:26:33 +01:00
Brad Jorsch
bba047c7ec API: Update docs on addWhere() and related methods
Change-Id: I189f0949e20b4e4ee130e3c7961635169853aeb4
2019-12-17 13:13:45 -05:00
Translation updater bot
c27126c6ca Localisation updates from https://translatewiki.net.
Change-Id: I29f9f2e57113b84d1f7c3053c62c9a11ed09ec55
2019-12-17 08:53:38 +01:00
jenkins-bot
e398253aba Merge "ApiEditPage: Fix error message for edit conflicts" 2019-12-16 18:01:06 +00:00
Brad Jorsch
605d3a3812 ApiQueryUserContribs: Stringify user names in query
Until I70473280, integer literals were always quoted as strings, because
the databases we support all have no problem with casting
string-literals for comparisons and such.

But it turned out that gave MySQL/MariaDB's planner problems in some
queries, so we changed it to not quote actual PHP integers.

But then we run into the fact that PHP associative arrays don't preserve
the types of keys, it converts integer-like strings into actual
integers. And when those are passed to the DB unquoted for comparison
with a string-typed column, MySQL/MariaDB screws up the comparison while
PostgreSQL simply throws an error. Sigh.

So ensure the user names passed to the database are actually strings.

Bug: T240808
Change-Id: If2bca6ab9faa5b50516e47f06b0b26b3648e4cbf
2019-12-16 09:10:13 -05:00
Translation updater bot
a0fcffb38b Localisation updates from https://translatewiki.net.
Change-Id: I829c1f93f7cf3274945c7b33cacd9044e8140bc9
2019-12-16 11:16:46 +01:00
jenkins-bot
980666d5c7 Merge "API: Deprecate wgEnableOpenSearchSuggest and opensearch+suggest parameter" 2019-12-13 18:26:04 +00:00
Timo Tijhof
15dbbe324c API: Deprecate wgEnableOpenSearchSuggest and opensearch+suggest parameter
The OpenSearch and prefixsearch APIs are always on for external use.

This internal parameter and feature flag was used as emergency switch
when the feature was still new, as a way to selectively ignore queries
from our own frontend code if we decided to turn the feature off.

At the time, there was also the $wgEnableMWSuggest configuration variable.
The idea being that if the JS is undeployed, it may still be cached in the
HTML and in some browsers. The $wgEnableOpenSearchSuggest variable allowed
the MW servers to identify those requests and return empty array without
any further DB load. Thus returning an empty array, which the frontend
at the time (mwsuggest.js) treated the same way visually as if the suggestion
feature didn't exist.

Since then:
* $wgEnableMWSuggest was removed in MediaWiki 1.20. The search suggestions
  in Vector and other skins are now always on.
* The "Disable search suggestions" user preference was removed
  in MediaWiki 1.23 (T54812).

Proposing to remove this additional complexity.

Change-Id: Iec572012de171d02871b8dc3207d2b34d17bf9ef
2019-12-13 18:11:43 +00:00
Bartosz Dziewoński
88a723bd87 ApiEditPage: Fix error message for edit conflicts
The 'editconflict' message is used by the normal edit form, and it
expects a parameter (page name), which was never passed.
'edit-conflict' should have been used instead.

This doesn't change the error code, which is mapped in ApiMessageTrait
and it already has a case for 'edit-conflict'/'editconflict'.

Change-Id: Ic95af27a67b95310b27ec344503d0a5cd88d79a2
2019-12-13 15:46:41 +01:00
jenkins-bot
5a668b0791 Merge "Localisation updates from https://translatewiki.net." 2019-12-13 09:16:28 +00:00
jenkins-bot
cab00f54ab Merge "Return HtmlArmor for Search ResultSet snippets" 2019-12-13 08:27:35 +00:00
Translation updater bot
941eb7d95c Localisation updates from https://translatewiki.net.
Change-Id: I6201eac71c4fdcf08d50a9f414e0fad076516409
2019-12-13 08:32:12 +01:00
Erik Bernhardson
0c8289e5db Return HtmlArmor for Search ResultSet snippets
Passing around strings that are expected to be safe html and are
known to be based on user input is a fairly unsafe operation. Make
it harder to do the wrong thing by requiring HtmlArmor to be returned
from the ResultSet snippets. This does not address the snippets on
individual result objects as the api surface is larger and requires
more bc handling.

Change-Id: I76231d6fc53c4982eb4cd174d2e6a75eb2740497
2019-12-12 10:14:50 -08:00
Translation updater bot
e57586072b Localisation updates from https://translatewiki.net.
Change-Id: Ia61d116950005fa52703449a8406d8af4296bba5
2019-12-12 08:49:54 +01:00
Amir Sarabadani
de9b8ac318 Set default for ApiPageSet::mParams to empty array
Now we can do this given we are using php7, this would also fix some
errors in php 7.4

Bug: T239761
Change-Id: I78254afd16ec88e3bf2ffa4890b92275bd794596
2019-12-11 14:00:20 +01:00
jenkins-bot
9d8954a372 Merge "build: Upgrade phan to 0.9.0" 2019-12-09 16:15:27 +00:00
Daimona Eaytoy
ce0856b12f Fix more scalar types in docblocks
Change-Id: I574d4e261ab986e028c3ce26c4f0ec648b88a2ac
2019-12-08 17:59:08 +00:00
Daimona Eaytoy
598c4d7fcb build: Upgrade phan to 0.9.0
Scalar casts are still allowed (for now), because there's a huge amount
of false positives. Ditto for invalid array offsets.

Thoughts about the rest: luckily, many false positives with array offsets
have gone. Moreover, since *Internal issues are suppressed in the base
config, we can remove inline suppressions.

Unfortunately, there are a couple of new issues about array additions
with only false positives, because apparently they don't take
branches into account.

Change-Id: I5a3913c6e762f77bfdae55051a395fae95d1f841
2019-12-07 20:16:19 +00:00
Umherirrender
7286cf1c96 Avoid master connections for prop=info and intestactionsdetail=full
There is no security issue using RIGOR_FULL here, because the
information is not used to take an action. It is used for information to
the caller and the caller may not allow the action.
But even the caller allows the action, the action api code would check
permission with RIGOR_SECURE before doing the action.

Also use the constant to make clear which string is from api and which
one is from the PermissionManager

Bug: T239451
Change-Id: If182f0e967187704ba3fdd14592a0badff097571
2019-12-06 21:29:15 +01:00
Translation updater bot
90bbed0f12 Localisation updates from https://translatewiki.net.
Change-Id: Ic48076bba16ee063b6a034d87b29137599237a05
2019-12-06 08:37:38 +01:00
Translation updater bot
7f4f113158 Localisation updates from https://translatewiki.net.
Change-Id: Ie594819bdc46f38329c265a372453c9392bfef2f
2019-12-05 08:34:50 +01:00
jenkins-bot
f4489908ce Merge "Set visibility on ApiQueryImageInfo::getTransformCount" 2019-12-04 21:39:36 +00:00
jenkins-bot
fde4381fc0 Merge "Remove hacks for lack of index on rc_this_oldid" 2019-12-04 21:39:22 +00:00
Umherirrender
268ffea9a2 Set visibility on ApiQueryImageInfo::getTransformCount
Change-Id: I41a088963ffbf35a97617f224cd6b80e8ae5570d
2019-12-04 22:23:28 +01:00
Brad Jorsch
152376376e Remove hacks for lack of index on rc_this_oldid
In several places, we're including rc_timestamp or other fields in a
query selecting on rc_this_oldid because there was historically no index
on the column.

The needed index was created by I0ccfd26d and deployed by T202167, so
let's remove the hacks.

Bug: T139012
Bug: T239772
Change-Id: Ic99760075bde6603c9f2ab3ee262f5a2878205c7
2019-12-04 16:00:02 -05:00
Brad Jorsch
9084591e10 ApiEditPage: Test for bad redirect targets
Apparently everything downstream assumes callers already handled
interwiki titles.

Bug: T239428
Change-Id: Ie54f366986056c876eade0fcad6c41f70b8b8de8
2019-12-04 19:22:41 +00:00
jenkins-bot
5afbc90670 Merge "Add 'slot' param for recentchanges API query" 2019-12-03 20:51:23 +00:00
jenkins-bot
dce7e7c384 Merge "Remove duplicate variable name from class property PHPDocs" 2019-12-02 16:09:39 +00:00
Thiemo Kreuz
78ca9eff4a Remove duplicate variable name from class property PHPDocs
Repeating the variable name doesn't do anything. Documentation
generators don't need it. It's more stuff to read that doesn't add new
information. And it can become outdated.

Note there are two types of @var docs. When used inline (and not on a
class property) the variable name is needed.

Change-Id: If5a520405efacd8cefd90b878c999b842b91ac61
2019-12-02 12:58:29 +00:00
Translation updater bot
b2882643d1 Localisation updates from https://translatewiki.net.
Change-Id: Ie325806ed14ea7cc82552a863c9ee33da1ed9809
2019-12-02 08:29:24 +01:00
Translation updater bot
5950111f24 Localisation updates from https://translatewiki.net.
Change-Id: I99982b02b1f7d3e945ab059b169b6afe06a83f19
2019-11-29 08:33:21 +01:00