| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead
Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a
Break one long line in SpecialPage.php
Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
|
|
|
|
|
|
|
|
|
|
|
| |
Providing the function name is often optional from the php code,
but it is needed for better logging, so make it mandatory and let phan
report issues about this.
Bug: T374546
Depends-On: Iaed5489a85a5a6e685829e151436afc94310fbd0
Depends-On: Ie2a1e5052e5b61bbb5b89905de942f47d3f1413d
Change-Id: I5227f2fa65850ac8c6f620900f22d1f4e7bfd470
|
|
|
|
|
|
|
|
|
|
| |
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.
Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.
Change-Id: I6dd402a5bca0c2136595faedae315959bbcf17d9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
wfGetUrlUtils() is also deprecated, but less so, so we can do this first
and then properly replace the individual uses with dependency injection
in local pieces of work.
Also:
* Switching Parser::getExternalLinkRel to UrlUtils::matchesDomainList
exposed a type error in media.txt where $wgNoFollowDomainExceptions
was set to a string (which is invalid) instead of an array.
Bug: T319340
Change-Id: Icb512d7241954ee155b64c57f3782b86acfd9a4c
|
|
|
|
|
| |
Bug: T319340
Change-Id: I757180bd8aa59bd51bd42661724dc99f8d56016f
|
|
|
|
|
|
|
|
|
|
|
| |
connectionTimeout, deprecated in 1.35
In 1.35 we deprecated not passing the timeout and connectionTimeout settings
when constructing the MWHttpRequest object.
Upgrade hard-deprecation via wfDeprecated() to instead throw an InvalidArgumentException.
Change-Id: I260469c6235fa9022b264757b0a17d498cee1396
|
|
|
|
|
|
|
|
|
|
|
| |
* Switch out raw Exceptions, mostly for InvalidArgumentExceptions.
* Fake exceptions triggered to give Monolog a backtrace are for
some reason "traditionally" RuntimeExceptions, instead, so we
continue to use that pattern in remaining locations.
* Just entirely give up on PostgresResultWrapper's resource vs. object mess.
* Drop now-unneeded false positive hits.
Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
|
|
|
|
|
|
|
|
| |
I'm not sure if there's a good way to split this up into
logical chunks.
Bug: T313841
Change-Id: I3b35a2e475b5143f383d4085fbc6a0ed3bbc32b8
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Introduce a new interface Wikimedia/Http/TelemetryHeadersInterface
that provides telemetry information that could be attached to
HTTP Requests. MultiHttpClient is expecting `telemetry` option
of TelemetryHeadersInterface type.
The MediaWiki/Http/Telemetry implements the interface, therefore
ObjectCache can inject it to RESTBagOStuff, that further injects
it to MultiHttpClient.
Bug: T344926
Change-Id: I59a3f1048c403fe2e4ef0c74353dfe74ff9ca893
|
|/
|
|
|
|
|
| |
This has been approved as part of RFC T166010
Bug: T321882
Change-Id: I6bbdbbe6ea48cc1f50bc568bb8780fc7c5361a6f
|
|
|
|
|
|
|
|
|
|
| |
This class is used heavily basically everywhere, moving it to Utils
wouldn't make much sense. Also with this change, we can move
StatusValue to MediaWiki\Status as well.
Bug: T321882
Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3
Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a Telemetry singleton for propagating `tracestate` and
`traceheaders` during a MW web request. This class allows for easier
testing and mocking.
In the future we might use this as a wrapper for OpenTelemetry.
Bug: T320559
Change-Id: I3e5e54afa21f8c099877b3765c769f2d2f8f5d61
|
|
|
|
|
| |
Bug: T324918
Change-Id: Ie03d4b25eb239bbbbc2346821a86f09c29e03524
|
|
|
|
|
| |
Bug: T324918
Change-Id: I360d57b5aa9e2e8cbfc8b5c5654ab1aaf1d944b3
|
|
|
|
|
|
|
|
|
|
| |
The motivation is to make the code less confusing. I hope this is the
case.
?? is an older PHP 7.0 feature.
??= was added in PHP 7.4, which we can finally use.
Change-Id: Id807affa52bd1151a74c064623b41d950a389560
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Introduced in PHP 7.1. Because it's shorter and looks nice.
I used regex replacement.
Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
|
|
|
|
|
|
|
|
| |
Part 1, proof of concept. Hundreds of files left to go. These changes
brought to you in large part by vim macros.
Bug: T305805
Change-Id: I44789091e9f6394c800a11b29f22528c8dcacf71
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make phan stricter about array keys
Remaining false positive issues are suppressed.
The suppression and the setting change can only be done together
Bug: T304887
Depends-On: I3105a5fd4826f8667b5232834defc5ec93be32a1
Depends-On: Ie9610a6e83731468311edb3ed17f80fc509de385
Change-Id: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef
|
|/
|
|
|
|
| |
Found by phan (T304887)
Change-Id: I3105a5fd4826f8667b5232834defc5ec93be32a1
|
|
|
|
|
|
|
|
|
|
|
|
| |
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.
Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228
* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.
A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki
Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
|
|
|
|
|
|
|
|
|
|
|
| |
Discussion on Ia16d8f86b1cb20 indicates that we want to go in the other
direction - MediaWiki shouldn't set X-Forwarded-Proto, rather the
reverse proxy (envoy in Wikimedia's case) should set it.
This follows-up cc241c2add4ebdd.
Bug: T288848
Change-Id: Ifc5e9da9a02b45d9d1ad51c3e1389f9ac7325c86
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
$wgLocalHTTPProxy can be used to configure a reverse proxy
for requests to domains in $wgLocalVirtualHosts. The previous
implementation of using it as a proper HTTP proxy is no longer
supported and has been reverted out of REL1_37 (856da72363d1ba8bf).
It sets the hostname of the request as a "Host" header, scheme as
"X-Forwarded-Proto" and then sets the proxy's scheme, host and port as
those of the request.
Bug: T288848
Change-Id: Ibc3616f5ad925d464d937ab15461a88619c8b7a7
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently requests to domains listed in $wgLocalVirtualHosts bypass
use of the standard $wgHttpProxy. With WMF's migration to Kubernetes, we
limit outgoing traffic in a much stricter manner, so even internal
requests will need to go over a proxy (e.g. Envoy).
If the domain passes MWHttpRequest::isLocalURL(), then $wgLocalHTTPProxy
will be used if set, otherwise no proxy will be used (current behavior).
Bug: T288848
Change-Id: Ifd0cbab02fa8f14a82ca34ebc7ad95b2be174434
|
|
|
|
|
|
| |
Found by sonarqube
Change-Id: I3464d25e94d98aaca55d9209d5175542b335f994
|
|
|
|
|
| |
Bug: T278594
Change-Id: I09a6175917090593e6e0055203a890c32bea03a5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.
Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.
Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add HttpRequestFactory::createMultiClient(), which returns a
MultiHttpClient with configured defaults applied. This is similar to
the recently-deprecated Http::createMultiClient().
* Introduce $wgHTTPMaxTimeout and $wgHTTPMaxConnectTimeout which, if set
to a lower value than their defaults of infinity, will limit the
applied HTTP timeouts, whether configured or passed on a per-request
basis. This is based on the frequently correct assumption that ops know
more about timeouts than developers.
* In case developers believe, after becoming aware of this new situation,
that they actually do know more about timeouts than ops, it is possible
to override the configured maximum by passing similarly named options
to HttpRequestFactory::createMultiClient() and
HttpRequestFactory::create().
* Apply modern standards to HttpRequestFactory by injecting a logger and
all configuration parameters used by its backends.
* As in Http, the new createMultiClient() will use a MediaWiki/1.35
User-Agent and the 'http' channel for logging.
* Document that no proxy will be used for createMultiClient().
Proxy config is weird and was previously a good reason to use
MultiHttpClient over HttpRequestFactory.
* Deprecate direct construction of MWHttpRequest without a timeout
parameter
Bug: T245170
Change-Id: I8252f6c854b98059f4916d5460ea71cf4b580149
|
|
|
|
| |
Change-Id: I5e04824d6fa6a4c36ce489850bb0ed7b4ac588f9
|
|
|
|
| |
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
|
|
|
|
| |
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
doSetCallback has no return value
Change-Id: Ifaf5c62d72bf7214a8733f7482adbbe033958f2e
|
|
|
|
| |
Change-Id: Id0837874896708adf4a950d3bd74ae92f4908851
|
|
|
|
|
|
| |
Both can have a string 'default'
Change-Id: I9c49cf7db762f251b010bc5469d4c1b4a7797f45
|
|
|
|
|
|
|
|
| |
This allows us to remove many suppressions for phan false positives.
Bug: T231636
Depends-On: I82a279e1f7b0fdefd3bb712e46c7d0665429d065
Change-Id: I5c251e9584a1ae9fb1577afcafb5001e0dcd41c7
|
|
|
|
|
|
|
| |
Bug: T231636
Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9
Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0
Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
|
|
|
|
|
|
| |
Bug: T231636
Depends-On: I50377746f01749b058c39fd8229f9d566224cc43
Change-Id: I2cd24e73726394e3200a570c45d5e86b6849bfa9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All methods got moved to HttpRequestFactory or MWHttpRequest or dropped.
I made the return value of the new HttpRequestFactory::request/get/post
methods null on error instead of false, so that when we drop PHP 7
support, we can use a "?string" return value. This could theoretically
change behavior of code that was switched from the old Http methods, but
probably won't. I kept the old behavior for the deprecated methods.
I changed the default value of $wgHTTPProxy from false to ''. This way
it should be usable directly without a trivial wrapper method. For the
benefit of anyone who might have set it to false in LocalSettings.php, I
also recommend casting to string just in case.
Http::$httpEngine is deprecated. Eventually it will be removed along
with the curl and PHP engines, leaving only the Guzlle engine.
I also added deprecation of MWHttpRequest::factory, which occurred in
1.31, to the release notes for 1.34. Now hopefully we can hard-deprecate
it in another couple of versions.
Bug: T214390
Change-Id: I2a316a758d793857f248bd251b90f5e9a6440e3a
|
|
|
|
|
|
|
|
| |
In order to be able to trace requests across the production environment,
we attach the X-Request-Id to outgoing requests.
Bug: T201409
Change-Id: Iadd6cbd51a78a1876a1a318783b51635717d054f
|
|
|
|
|
|
|
|
| |
* Use 'callable' instead of 'callback'.
* Remove '$' as part of a type name.
* Add missing type.
Change-Id: Ic1b39a7d8cbbee000d8fb2f3a1f71a621bd01993
|
|
|
|
|
|
|
|
|
|
| |
Provide backward compatibility for callback functions in
GuzzleHttpRequest, which was missing in T202110, and restore
GuzzleHttpRequest as the default provided by HttpRequestFactory.
Bug: T212175
Depends-On: I4b45e79d35252d13f714f3271b87301ca515121a
Change-Id: I60d1a034b44874f6d24a04058db264eeb565f5e1
|
|
|
|
|
|
|
| |
The lack of this documentation resulted in some confusion in T214032 and
related tasks.
Change-Id: I08fc201b625197614ef5e163ed3686638b630b13
|
|
|
|
|
|
|
|
|
|
| |
Task T202110 included a change to recognize an HTTP status code
of 0 (zero) as an error, but it failed to set a status message,
resulting in an exception. Changed to set a status message of
'Error' so that required value is not empty.
Bug: T212005
Change-Id: I5fb78555bfcaeccdd726432f4dfc70924a385c41
|
|
|
|
|
|
|
|
|
|
|
| |
Create a GuzzleHttpRequest class using the external Guzzle
(docs.guzzlephp.org) library. This will be the new default request type,
but CurlHttpRequest and PhpHttpRequest remain available and accessible
via Http::$httpEngine.
Bug: T202110
Change-Id: Ie720be2628d7baf427b002847f103fd86ee4cff3
Depends-On: I143a6410d111e75f01dbbfd43f300e2e60247451
|
|
|
|
| |
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
|
|
|
|
|
|
|
|
| |
If the curl extension is not available, fall back to the existing
HttpRequestFactory and associated classes. Also added related phpunit tests.
Bug: T139169
Change-Id: I2f9d4acbb491bce28d7105e124c5cee7e16e86d7
|