| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
In I53f9ae840c (commit 7c03a6f), the option was added to use
PARAM_HELP_MSG_PER_VALUE to also document parameters for multi-string
types, like templated parameters. See there for the reasoning.
This change adds the support in ApiParamValidator for that.
Follow-Up-To: I53f9ae840c0a7eee76c4b57f95390b5045707efd
Change-Id: Ia8c1abdcb68823650582208caa9be3fa2c47daa8
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The converter is no longer needed now that Message and MessageValue
use the same internal format for the message parameters.
Bug: T358779
Depends-On: I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83
Change-Id: I41392aca4ae6b40f3476397d7ca37ba6cadb2ae4
|
|/
|
|
|
|
|
| |
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
|
|
|
|
|
| |
Bug: T353458
Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow-up to 12a4c08ad83ef55e440b88e5f9d511fd224afa6f.
I didn't review it carefully enough to notice that when these
functions return arrays, they contain a message key and parameters,
not a key and fallback keys (while other API documentation message
code uses fallback keys).
Instead of `$this->msg( $msg )`, this code must be written as
`is_array( $msg ) ? $this->msg( ...$msg ) : $this->msg( $msg )`
or `$this->msg( Message::newFromSpecifier( $msg ) )`, both of which
are ugly, but the latter looks a bit better to me.
Bonus changes:
* Add documentation to prevent a repeat of this mistake in the future
* Remove some unreachable dieDebug() calls (the Message class already
throws for bad inputs)
It seems that we don't have any definitions using such arrays
in the core API classes. There are only a few uses in extensions,
e.g. AbuseFilter's 'apihelp-query+abuselog-param-filter' message,
which is passed the wrong parameter without this change.
Bug: T372988
Change-Id: I44c1c3c7d0c069e500c85a58c27e9b675b0b68ee
|
|
|
|
|
|
|
|
|
| |
Replace usages of ApiBase::makeMessage
with ApiBase::msg and deprecate the former
method
Bug: T370240
Change-Id: I9e6e775dad7f3e3cfd78351f87f4732677d90971
|
|
|
|
|
|
|
|
|
| |
In JSON request bodies, empty strings should be accepted in required
string fields. So far, empty strings are considered as missing, which is
the default behavior for query parameters.
Bug: T305973
Change-Id: I97a9556bb440b9564e7d3618d189df4ef6f6725c
|
|
|
|
|
|
|
| |
The new trait provides conveniance methods for logging and throwing
errors based on StatusValue instances.
Change-Id: Id7cbacb744bee79cd8a6f61291a26b36e6243053
|
|
|
|
|
| |
Bug: T353458
Change-Id: I088cbc53fbcdb974e5b05b45a62e91709dacc024
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the code quit a bit more readable, I believe.
strpos is especially confusing because it can return false when a
string doesn't contain the needle, as well as 0 when the string
starts with the needle. This is sometimes used as a feature (i.e. to
check if a string contains the needle, but doesn't start with it),
but that's not the case here.
A slightly more complicated change is made in TitleTest. But this is
only in a test and should verify itself when the test still succeeds.
Change-Id: I355ad1dc8e1725ae7a1eb652ec047ce7ff589cdf
|
|
|
|
|
| |
Bug: T245964
Change-Id: I1ff9ed3188fb8d45ecfde8b4b1e269c5d482ea1f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When no PARAM_HELP_MSG is set, the code builds a dynamic message key in
ApiBase::getFinalParamDescription, check the possible message as well
To make core tests pass in ApiFeedWatchlist the PARAM_HELP_MSG must be
always set
Depends-On: Iedb4f9d9f53a06d0ff8c11309de6c546182f752e
Depends-On: If490db5eef5db8fef349cd287232a409ae2dc85f
Depends-On: Ief80d8524472051fc03aec75047fc7a2127aab26
Depends-On: I74d2575de9765d69d967a0760a10b735eb811eca
Depends-On: Ib18c90b71d586750beb80171cc8109322e87bd92
Depends-On: Ia6e63188e3776476d401c8c2f266a370aa35a3bf
Depends-On: Iffed1a77f9267d382abaeffe533e577fca6a2844
Depends-On: I0f548b47121e07dd4199428d015df3da85166843
Change-Id: Id1a42b4a7742b96bdc9a55703a225d23c04d2991
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the array with PARAM_HELP_MSG_PER_VALUE is empty,
the code builds a dynamic message key in
ApiBase::getFinalParamDescription, check the possible messages as well
Depends-On: Id14c693f9f93eb2800605ce4235030926a534bd4
Depends-On: I2ff53e12de9df8fe55bbdb668a72e0ba24c4f7b8
Depends-On: I180350e9df08af61c2c01360e0f4bcfd1c764a20
Depends-On: I18dd746d142fe4bc22ab99bd3d5fc1d293f002ba
Change-Id: I6cbaa8d9392f838408c4d3c23ae993009ccc917c
|
|
|
|
|
| |
Bug: T321882
Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
|
|
|
|
|
|
|
| |
Use the new function in conditions to avoid creating substrings or to
search the whole string
Change-Id: Ibad6b1b447a4f62cceb34359231f88ebb967a90b
|
|
|
|
|
|
|
|
|
| |
This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922.
Reason for revert: T166010#8349431
Bug: T166010
Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Moving:
- DerivativeRequest
- FauxRequest
- FauxRequestUpload
- PathRouter
- WebRequest
- WebRequestUpload
Bug: T166010
Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
|
|
|
|
|
|
|
| |
Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324
Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9
Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5
Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
|
|
|
|
| |
Change-Id: I852453fbeeebdc4e34c0b35c0fdca4b4ab74fde9
|
|
|
|
| |
Change-Id: I1c544ef58ebb2c83ebdcf7284a8dad2ed364c608
|
|
|
|
|
|
|
|
|
|
| |
Migrate away from the Title object, use
TitleParser::parseTitle() which returns a
TitleValue which is enough. Will be followed by
switching UserDefTest to a unit test, but in a separate
commit.
Change-Id: Ia756964861c4e0f3edea89f6beec2643243ca741
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Maintain the existing behavior for creating based on a user
id or name that does not correspond to an existing user:
* if creating a User object based on the id 0, User::loadFromId()
will load the defaults with the name being set to false, and
User::getName() will convert that false to the ip of the current
request. We probably don't want UserDef to be doing that, but
this behavior should be changed separately - at the moment
we are just matching the existing behavior (see the prior commit
which adds tests to confirm the behavior isn't changing)
* if creating a User object based on an id that cannot be found
in the database, User::loadFromDatabase() will load the same
defaults, *except* that it will set the user name to "Unknown user"
* if creating a User object based on a name, User::getId() will,
if the id isn't already known, return 0 if the name matches
UserNameUtils::isIP() or ExternalUserNames::isExternal(). However,
the User object is currently only created based on a name after
passing an ExternalUserNames check, and the creation with
RIGOR_VALID prevents it from being an ip. Thus, the existing
code will call User::load(), which will check the database or
fallback to 0 if the user does not exist.
When creating a User from an id that does not exist, User::getId()
will return that id, until after the object tries to fully load,
after which it'll return 0 for the id. Since we cannot replicate
this with UserIdentity (switching the id to 0 only after getName()
is called for the first time) we set the id to always be 0, which
is more accurate. This is the only change in behavior.
We will remove the use of the context ip in a follow-up that will
switch to using "Unknown user" instead.
Accordingly, we will use a UserIdentityLookup as well as
manual construction of UserIdentityValue objects to match this
behavior.
Bug: T288311
Change-Id: Ida80c5d04d721fafa8d66f656dbd346c6cf643eb
|
|
|
|
|
|
|
|
|
|
| |
This helps phan to detect unreachable code and also impossible types
after the functions.
It helps phan to avoid false positives for array keys
when the keys are checked before
Bug: T240141
Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
|
|
|
|
| |
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
The following sniffs now pass and were enabled:
* Generic.ControlStructures.InlineControlStructure
* MediaWiki.PHPUnit.AssertCount.NotUsed
npm:
* svgo: 2.3.0 → 2.3.1
* https://npmjs.com/advisories/1754 (CVE-2021-33587)
Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
|
|
|
|
|
|
|
|
|
| |
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The mandatory Unicode NFC normalization on API parameters was causing
spurious dirty diffs in VisualEditor/DiscussionTools when editors used
HTML entities to encode non-NFC codepoints, like  . Although
wikitext is (ought to be!) in NFC form, the output HTML may not be,
due to explicit entities in the wikitext.
This type is used in VisualEditor change
I0d34c9a01f1132c2616ed3392ea40d8b73e15325 to prevent Parsoid HTML from
being corrupted when it is round-tripped.
Bug: T266140
Change-Id: I2e78e660ba1867744e34eda7d00ea527ec016b71
|
|/
|
|
|
|
| |
Always throws an exception
Change-Id: I2c95109a956e23425767b98bc35ae61b9df82e04
|
|
|
|
|
|
| |
The ISMULTI logic is copied from UserDef.
Change-Id: I794e2277c462b86cb5c3888d1ba509b11fad62aa
|
|
|
|
|
|
|
|
|
|
|
| |
- Begin injecting services into UserDef to support
unit tests.
- Replace static User class functions with
UserFactory functions.
Bug: T259145
Bug: T257464
Change-Id: Iccc0c39e013679f15f2e62738c56df09ba56c494
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit also changes ApiWatch to make use of the new parameter type.
Other APIs will be updated to use it in a separate patch (T248196).
In doing this, we are for the first using logic within a TypeDef outside
the API. This seems acceptable given TypeDefs chiefly appear to serve as
a validation method, with otherwise no particular logic tied to the
concept of APIs.
wfIsInfinity() now uses ExpiryDef::INFINITY_VALS
Bug: T248508
Change-Id: If8f0df059eafb73ec9f39cc076b3a9ce2412d60a
|
|
|
|
|
|
|
|
|
|
| |
Notably:
* In ApiManageTags, I used a switch instead of a dynamic function name,
so that the call graph will be correct.
* In ApiImageRotate, checkTitleUserPermissions() has always returned
void, this was an error introduced in 4e6810e4a2c1d821d8d108c
Change-Id: Iea22616b8e7e2e0cc804619a54f8690898b2cb82
|
|
|
|
|
|
|
|
|
|
| |
ApiStructureTest has a lot of logic for validating Action API settings
arrays during CI. Some of that logic should be part of ParamValidator
instead.
Bug: T242887
Change-Id: I3c3d23e38456de19179ae3e5855397316b6e4c40
Depends-On: I04de72d731b94468d8a12b35df67f359382b3742
|
|
This brings significant modularization to the Action API's parameter
validation, and allows the Action API and MW REST API to share
validation code.
Note there are several changes in this patch that may affect other code;
see the entries in RELEASE-NOTES-1.35 for details.
Bug: T142080
Bug: T232672
Bug: T21195
Bug: T34675
Bug: T154774
Change-Id: I1462edc1701278760fa695308007006868b249fc
Depends-On: I10011be060fe6d27c7527312ad41218786b3f40d
|