| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Use modern php syntax to call a callable.
Reduce the stack trace to improve performance
and better IDE and static analyzer support
Change-Id: I9ef131032a662a3b8db69aa7079dbd51f88f575a
|
|
|
|
| |
Change-Id: I0f8a8cac36015bba52aea3ee2affd92f83d3574a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Same as Ia294bf4 did for 1-line comments. This patch removes slightly
more complex 2-line PHPDoc comments that don't add any new information
to the code, but literally repeat what the code already says.
They say "don't document the code, code the documentation", and we
are doing this more and more. We just tend to forget to remove the
obsolete comments.
Note I'm also removing a line of text in a few cases when it's very
short and literally says the same as the method name. Again, such
comments add zero new information.
Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I assume these are all either auto-generated by an IDE or the
language-level type declarations have been added later. In any case
the comments don't add any new information to what the code already
says. This is just extra clutter that makes the code harder to read,
I would argue.
There are many, many more comments like this. In this patch I
intentionally focus on the most trivial 1-line comments.
Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
|
|
|
|
|
|
|
|
| |
This will attach HTTP request spans to the Mediawiki-created
span, instead of the Envoy-created span.
Bug: T340552
Change-Id: Icf61c35468bce41fe3f7051221f2b81c55030166
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
isset() should only be used to suppress errors, not for null check.
When the property is always defined, there is no need to use isset.
Found by a new phan plugin (2efea9f989)
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset
Change-Id: Ib84b7d71e8308a36409f30ecfd16e9de149e97b3
|
|/
|
|
|
|
|
|
|
| |
isset() should only be used to suppress errors, not for null check.
When the property is always defined, there is no need to use isset.
Found by a new phan plugin (2efea9f989)
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset
Change-Id: I186e799256fbaf5ee77558bd146f9418dd5eaacc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As stated in the linked task, it is not guaranteed that we can't serve
"local" requests in cli mode. This is only true if the following
assumptions are also true:
* you run the cli scripts on a different machine as the webserver
* You don't run a service mesh to mediate between MediaWiki and the
external services
While the former is true for the wikimedia production setup, it's not a
common setup at all. On the other hand, it's been quite a few years since
Wikimedia started using a service mesh.
So it seems to me that for the absolute majority of installations, this
condtional was actually harmful.
This patch allows using the local proxy also in cli mode, and puts
control back in the hands of the system administrators.
Bug: T381251
Change-Id: I724a1e840d586db2b6b57b9990a5747290e39494
|
|
|
|
|
|
|
|
| |
Found by Phan thanks to the type hints being added in
I3e0df790ff9db2fa630f82408a7254a359fe61ca.
Bug: T378876
Change-Id: I286a4a51e879bdf61f65c87dc078621c51045bee
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
The timestamp is redundant with the timestamp that should be injected
by the log formatter, and it makes it more difficult to find identical
log messages.
Change-Id: Ifa0529a5f8233be5adc16fa7632542f39916fda9
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Callers should not catch an unchecked exception, so it doesn't belong
in a function signature. Unchecked exceptions indicate a coding error,
which by definition the code will not be able to handle correctly.
If any of these exceptions were supposed to be in response to an edge
case, user input, or initial conditions, then they should be changed
to a runtime error. If the exception class cannot be changed, then
the annotation should include a comment explaining its purpose and
prognosis.
Bug: T240672
Change-Id: I2e640b9737cb68090a8e1cb70067d1b74037d647
|
|/
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I017bcaffe6945d633d7387f9391803845369bfed
|
|
|
|
|
|
|
|
|
| |
This patch introduces a namespace declaration for the
Wikimedia\Http to MultiHttpClient and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I4ebc1a3b496de08b2b430301da376578d13fcfe6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The @internal annotation was added
in I3e5e54afa21f8c099877b3765c769f2d2f8f5d61
with no explanation. The current annotations advise extensions
to not use HttpRequestFactory, which renders extensions
unable to make HTTP requests when they need to.
This appears to be a declaration added by a mistake,
intending to make the constructor itself as @internal.
Since constructors are unstable by default, this patch
removes the @internal annotation with no replacement.
Change-Id: I9696034fb014c6a87b4532bff22d8c9d494e9bb1
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Follow-Up: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
Change-Id: Iac6aa104331ffc26460f8360b252e03d2307e6fd
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
| |
This makes it much easier for IDEs and tools like Phan to understand
what's going on. Note this syntax is perfectly valid even if a class
is undefined. Language features like `use`, `instanceof`, and
`class_exists` work perfectly fine. We do this a lot in existing
code.
Change-Id: I4d397621ebcc6a7e842150f7641c1b23d082b730
|
|
|
|
|
|
|
|
| |
I'm not sure if there's a good way to split this up into
logical chunks.
Bug: T313841
Change-Id: I3b35a2e475b5143f383d4085fbc6a0ed3bbc32b8
|
|
|
|
|
|
|
|
|
|
| |
ShellboxClientFactory should depend upon HttpRequestFactory to provide
a fully initialized HTTP Client. It shouldn't handle things like
`X-Request-Id` as it's HTTP layer responsibility. More over the
`WebRequest::getRequestId()` got deprecated in favour of Telemetry class.
Bug: T346209
Change-Id: If7630f81be4d7ca94ab0cac02b2a30126e3a297d
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|
|
|
| |
Change-Id: Ia764e1b4a4d306ab4fe294aa45fd0f8306810b19
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After deploying T320559 we found out that JobRunner sometimes calls
the WebRequest::overrideRequestId() with a null. This caused the
TelemetryService to fail due to $newId not being a string.
As a solution there is a new method called regenerateRequestId()
that will handle the regeneration as it's recommended to keep the
overrideRequestId() strict.
Bug: T343893
Change-Id: I3e6daa238fd8de0d9ea88660b8ba32b922b1323d
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The class and all functions are deprecated:
- Http::request()
- Http::get()
- Http::post()
- Http::userAgent()
- Http::isValidURI()
- Http::getProxy()
- Http::createMultiClient()
Bug: T305813
Change-Id: Icd8af4822b16b4bf4558b756e20171c3ae9a9fa1
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Http::request
* Http::get
* Http::post
* Http::userAgent
* Http::isValidURI
Bug: T305813
Change-Id: I4f8410f43128c0f53742cca055027c2e9ebcde44
|
|/
|
|
|
| |
Bug: T324918
Change-Id: I360d57b5aa9e2e8cbfc8b5c5654ab1aaf1d944b3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MwHttpRequest has a logger option, but GuzzleHttpRequest ignored
it; fix that.
This will log something like
[2023-02-08T06:50:29+00:00] GET http://127.0.0.1:22100/ HTTP/1.1 - 301 NULL
to the http channel, at level INFO on successful and at level
ERROR on failed requests.
Change-Id: I2e4067c67aace434ed111a1a09f03888ea43e924
|
|
|
|
|
| |
Bug: T324895
Change-Id: Ic347beb30b50fe76f02855700f770195a5eabf8a
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Doc-only changes
Change-Id: I5177f582ae7ee70c357e9389fed14819faf79463
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This edition brought to you by:
grep -ERIn $(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | tr
"\n" '|' | sed 's/|$/\n/') includes/
I only corrected a fraction of the results provided by that command. I'm
submitting the partial patch now so it doesn't bitrot.
Bug: T305805
Change-Id: If1918c0b3d88cdf90403921e4310740e206d6962
|
|
|
|
|
|
|
|
| |
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
|