Commit graph

6468 commits

Author SHA1 Message Date
Peter Ovchyn
61e0908fa2 languages: Introduce LanguageConverterFactory
Done:
* Replace LanguageConverter::newConverter by LanguageConverterFactory::getLanguageConverter
* Remove LanguageConverter::newConverter from all subclasses
* Add LanguageConverterFactory integration tests which covers all languages by their code.
* Caching of LanguageConverters in factory
* Make all tests running (hope that's would be enough)
* Uncomment  the deprecated functions.
* Rename FakeConverter to TrivialLanguageConverter
* Create ILanguageConverter to have shared ancestor
* Make the LanguageConverter class abstract.
* Create table with mapping between lang code and converter instead of using name convention
* ILanguageConverter @internal
* Clean up code

Change-Id: I0e4d77de0f44e18c19956a1ffd69d30e63cf51bf
Bug: T226833, T243332
2020-02-03 11:38:03 +02:00
Translation updater bot
d60c1c1b3f Localisation updates from https://translatewiki.net.
Change-Id: I0059fc2f3b780dd547a32d1637b4a5fb1c7615ee
2020-02-03 07:55:20 +01:00
Translation updater bot
ed8604f229 Localisation updates from https://translatewiki.net.
Change-Id: Ib1eb92ce2249eadf6786686bf77b9507f708349c
2020-01-31 09:20:41 +01:00
Translation updater bot
e3a670e190 Localisation updates from https://translatewiki.net.
Change-Id: I801dd48f22b98eb3e17dc7c5b49d1fe602cc63f3
2020-01-29 07:54:28 +01:00
jenkins-bot
e963682c34 Merge "ApiQueryAllRevisions: Fix second example" 2020-01-28 18:46:52 +00:00
DannyS712
76ddd260a2 ApiQueryAllRevisions: Fix second example
Bug: T241806
Change-Id: Ifc349b299dc75f8423a7308b333a4334cd28a8f6
2020-01-28 17:46:58 +00:00
jenkins-bot
aba8016fae Merge "Upgrade phan to 0.9.1" 2020-01-26 07:44:22 +00:00
Daimona Eaytoy
41ee2f2c61 Upgrade phan to 0.9.1
Released just now.

Many old suppressions can now be removed. Enabling the issue for
undeclared variables is left to do later, given that there are
roughly 200 warning.

Change-Id: I99462a1e9232d6e75022912e2df82bc2038476ef
2020-01-25 10:53:26 +00:00
jenkins-bot
8a19838915 Merge "ApiParse: Use the right Skin object for building section edit links" 2020-01-24 22:01:28 +00:00
Bartosz Dziewoński
965b788178 ApiParse: Use the right Skin object for building section edit links
Apparently the section edit links may depend on state that is
available through context in the Skin object, but not necessarily
through the global context, such as the current user and page title.

Allow ParserOutput::getText() to take a 'skin' option for this purpose.

Bug: T234868
Change-Id: Iaa83e5f801c7776bf8218d8ce7484e2485b227d4
2020-01-24 18:53:20 +01:00
jenkins-bot
3c896fce16 Merge "Drop support for passing a User to ApiBase::checkTitleUserPermissions" 2020-01-24 17:52:53 +00:00
Translation updater bot
e1ef300f07 Localisation updates from https://translatewiki.net.
Change-Id: I12c78740a5344967d7328ae9552b1eb18eaac303
2020-01-24 07:55:55 +01:00
DannyS712
df46acc56d Drop support for passing a User to ApiBase::checkTitleUserPermissions
Deprecated and unused

Bug: T241354
Change-Id: I7726eba3e583548a284bffb8a28df0767bda31b4
2020-01-23 10:44:22 -08:00
Translation updater bot
c1b445c44c Localisation updates from https://translatewiki.net.
Change-Id: Ib93db5231d13831aca093bda28c8a2bf5204d853
2020-01-20 07:54:53 +01:00
jenkins-bot
a4d9ec9f1e Merge "Remove unused variable $commentStore" 2020-01-20 05:18:01 +00:00
Tim Starling
5873281251 Remove unused variable $commentStore
Change-Id: I0c1c135962c62a0a979afc513b41768eee110b33
2020-01-20 15:59:06 +11:00
Translation updater bot
24b512a03a Localisation updates from https://translatewiki.net.
Change-Id: I9e30191999637586fe54b9313bf40fce7ca48857
2020-01-16 09:09:38 +01:00
Translation updater bot
283d9144f6 Localisation updates from https://translatewiki.net.
Change-Id: If522b945e7394e53dc3eeeb0a735434fceebec4f
2020-01-15 09:29:47 +01:00
Translation updater bot
34d115b481 Localisation updates from https://translatewiki.net.
Change-Id: Ie1afc962d9fe56d72987f45c2433977028e0ab7e
2020-01-13 08:29:13 +01:00
James D. Forrester
0958a0bce4 Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNull
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
2020-01-10 14:17:13 -08:00
James D. Forrester
41f8acfd52 Coding style: Auto-fix MediaWiki.Commenting.DocComment.*
Change-Id: Iea5a07e10712723970a15008eb367e0af226fcc3
2020-01-10 12:28:12 -08:00
James D. Forrester
4f2d1efdda Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
2020-01-10 09:32:25 -08:00
Translation updater bot
52a4a58beb Localisation updates from https://translatewiki.net.
Change-Id: I28c5d80048a974e8261e60cc1ba0540a57846016
2020-01-10 08:06:21 +01:00
jenkins-bot
5f477d7877 Merge "mw.Api: Add helper method #getErrorMessage" 2020-01-09 13:54:38 +00:00
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
Bartosz Dziewoński
7171488c71 mw.Api: Add helper method #getErrorMessage
Given an API response indicating an error, it returns a jQuery object
containing a human-readable error message that you can display
somewhere on the page.

Handling the "real" API responses from the server is easy, since they
already contain the error message and we basically just extract it.
The important part of this patch is handling the issues that happen
on the client, or server-side issues where the error-handling API
code never runs, so we have to figure out what happened and make up
our own error message.

I have not yet seen any mw.Api consumer that handles all the error
cases correctly (I thought VisualEditor did, but in the process of
writing this patch I learned that we missed a few cases there as
well), and most don't even try. This might not be perfect but it
should be the closest thing so far.

The new code is inspired by error handling in VisualEditor (see
I69d9432162f195dcfe9470485b549a1b007617ff) and in mw.Upload.BookletLayout.

New messages:
* 'api-clientside-error-noconnect'
  - Adapted from 'apierror-offline' and 'visualeditor-error-noconnect'
* 'api-clientside-error-http'
  - Adapted from 'visualeditor-loadwarning' and 'visualeditor-error-http'
* 'api-clientside-error-timeout'
  - Copied from 'apierror-timeout'
* 'api-clientside-error-aborted'
  - Entirely new
* 'api-clientside-error-invalidresponse'
  - Copied from 'visualeditor-error-invalidresponse'

Update some existing code to use it, as an example:
* mediawiki.page.watch.ajax
  - Removed messages: 'watcherrortext'
* mediawiki.special.unwatchedPages
  - Removed messages: 'watcherrortext'
* mediawiki.action.edit.preview
  - (errors were hardcoded in English)
* mediawiki.feedback
  - Removed messages: 'feedback-error2', 'feedback-error3'
    (error1 and error4 remain, they handle errors not caused by the API)
* mediawiki.Upload.BookletLayout
  - Removed messages: 'apierror-timeout', 'apierror-offline', 'apierror-unknownerror'
* mediawiki.page.ready
  - Removed messages: 'logout-failed'
* 'mediawiki.page.patrol.ajax
  - (the messages are already used by the patrol API)

Example usages in extensions:
* VisualEditor: I69d9432162f195dcfe9470485b549a1b007617ff
* DiscussionTools: Ice92fafb1f546510dab28e3f8aa7d2280668965a

Bug: T240519
Change-Id: Ie18666b41f4aff1ab4bcf93f9df6e3000ac7b500
2019-12-14 17:17:45 +01:00