| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows-up I1b9435dcdacd952b, which introduced this and silenced the
warning, but it appears this warning is spot-on:
> $ composer phpcs
> …
> assertEquals accepts many non-zero values, please use strict alternatives like
> assertSame (MediaWiki.PHPUnit.AssertEquals.Int)
We don't want to tolerate something like this:
```
var_dump(1 == true);
class Foo{}
var_dump(1 == new Foo());
var_dump(1 == (object)[]);
var_dump(1 == new stdClass);
var_dump(1 == '01.0');
var_dump(1 == '01.');
var_dump(1 == '01');
var_dump(1 == '1');
```
Bug: T368740
Change-Id: Ib3966b96f65d41b1d320ae043dcbea1a445a55f5
|
|
|
|
| |
Change-Id: I56b31870ce9be46d15fcd9095f9a12e0f2488ed9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update a few remnant references inside the library while at it.
* WANObjectCache: Didn't use ATTR/QOS directly, and getQoS test
already implemnented as BagOStuff const.
Update getQoS() docs to match.
* WANObjectCache: Already documented ERR_ as BagOStuff::ERR_.
And Codesearch confirms no use of `WANObjectCache::(ERR|ATTR|QOS)`.
* MemcachedClient: Switch from referencing one to the other.
The class is not directly used outside core, only via
BagOStuff.
* Implicitly remove unused ATTR_EMULATION by not carrying over.
Follows-up:
* e8275758fe (I20fde9fa5c) Split IExpiringStore from BagOStuff,
and re-use in WANObjectCache.
* 74be3a0150 (I4377fc3f53) Move ERR_ from BagOStuff to IExpiringStore.
* 69950da666 (Ia862c5111a) Replace IExpiringStore with StorageAwareness.
* 59b002b866 (I9885f53f00) Remove StorageAwareness::QOS_LOCALITY_.
* ec90b543ab (I8dec3f73fa) Remove StorageAwareness::QOS_EMULATION_SQL.
* 62bdd78817 (I5649a29310) Adopt ERR_ in MemcachedClient.
* e5a3e36bd1 (I836735b1fe) Mark StorageAwareness as internal.
Bug: T353529
Bug: T364652
Change-Id: I1dfde995e29d5264611cf3500d61fe4d8631a7d7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mostly used find-and-replace:
Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4
More could be done, but to keep this patch reasonably sized, I only
changed the most obvious and unambiguously correct cases.
I made some bonus corrections to the type hints too.
Change-Id: Ic900d0a7c552ea3535276c1b47d87dcce66ec3d9
|
|
|
|
|
|
|
| |
Follow-up to 0fe5cc829ecfc7b0476d69821c446516483d24fe.
Bug: T382910
Change-Id: I8bd2e5d5815f37944ec4bfc5f586701a1116069b
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
Not needed (any more) because the code already contains
enough @return docs and such.
Change-Id: If461fa035d2c646878540565b3087a74c6628552
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Why:
- When a transaction lifecycle callback such as
onTransactionPreCommitOrIdle() is invoked by rdbms, rdbms passes in
the DB connection handle the callback was scheduled on.
- However, the DB connection handle may have since been reset to a
different DB domain on the same physical cluster due to connection
reuse.
- We could implement bookkeeping to keep track of the expected DB domain
for each pending callback and ensure the passed-in DB handle matches
that before invoking the callback, but nobody seems to be making use
of the passed-in DB handle except for two call sites in core.
- As such, it seems more prudent to remove this functionality.
What:
- Stop passing the DB connection handle to rdbms transaction lifecycle
callbacks.
Bug: T386190
Change-Id: I9125bfb8b5e2cac4aab3525ffd229ea49beccc17
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | | |
Bug: T368740
Change-Id: I1b9435dcdacd952b2bc703b3d5f7083406ebbed6
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
wfDeprecatedMsg was replaced with trigger_error for better alignment
with non-MediaWiki environments.
Change-Id: Icc5a58cb2eccf26def393a9715ab5089cf4b7951
|
|\ \ \ \
| |/ / /
|/| | | |
|
| | | |
| | | |
| | | |
| | | | |
Change-Id: I0f8a8cac36015bba52aea3ee2affd92f83d3574a
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Why:
* Code in the CheckUser extension needs to know when the
expectations of a request are defined as POST-nonwrite.
** This is because CheckUser may need to make writes to the DB
as a result of an auto-creation of an account made during a
POST-nonwrite API request.
* This code cannot currently query the TransactionProfiler to
see the expectations for a request, and cannot also easily
see if the API request is non-writing.
** Allowing the CheckUser code to see the expectations for the
number of writes in the request will allow it to instead
insert the data using a job when writes are not expected but
still insert in the usual way when in a POST request that
allows writes.
What:
* Add TransactionProfiler::getExpectation which returns the
TransactionProfiler::FLD_LIMIT value for a given event name
** The method throws an InvalidArgumentException if the event
name provided is not recognised.
* Add tests for the new method.
Bug: T384915
Change-Id: I54dc388557c3b0cb4fd73625132fb64b14f4ddd0
|
| | |
| | |
| | |
| | |
| | |
| | | |
Bug: T240685
Bug: T364240
Change-Id: Id1fe4ac6127894c9861b0d904c7a55f21deb7455
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This seems the cleaner fix, since we do want to emit output headers
in lowercase, as that's what the rest of mediawiki/core emits nowadays,
as well as basically the rest of the world.
Bug: T384629
Change-Id: I8ea568e316c6e06b8c3d6f370b04be57dcbddc0a
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In ExpiryDef::normalizeExpiry(), throw an InvalidArgumentException if
the expiry string indicates a date outside of the years 0 - 9999. Such
timestamps fail in various exotic ways, so it's best to reject them
early.
Bug: T384241
Change-Id: Ic2110421e8ff1a8892d02b600a0dce965b36c82d
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Why:
- Some of the newly implemented propagator functionality is missing unit
tests.
What:
- Add relevant test cases.
Bug: T340552
Change-Id: I63333310f7ca49321768958c6be7a0da1fb73916
|
| |
| |
| |
| |
| |
| |
| |
| | |
Also condition using incoming span context upon
$wgAllowExternalReqID
Bug: T340552
Change-Id: Ib1cf361dd800c81a7943231441d58c790191ef5a
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* The LightweightObjectStore namespace was experimentally adopted for
two classes in 2020 with change Ia862c5111a3daf10a34fc78163301629,
however in 2024 when we namespaced the BagOStuff component as a
whole, we went with ObjectCache namespace in change Ie01962517e.
* The StorageAwareness class is internal since I836735b1fec8dfd, so
it can be freely renamed.
* Similar to I836735b1fec8dfd, further reduce direct use of it,
keeping it only as effectively an internal trait for adding a
consistent set of constants to 3 classes (Bag, Wan, MemcClient).
Bug: T353529
Bug: T364652
Change-Id: Ib10db39a91274e84a51a2eead94560b8d9137019
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Avoids weird-looking queries when the same field(+alias) is provided
twice, and throws an exception for potentially incorrect queries when
the provided fields(+aliases) conflict.
Change-Id: I03ba16fc3fce3f1468e518fb08dd65e705ca461f
|
|\| | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When you add the same field to the query builder more than once,
weird things happen.
Change-Id: I5cb51b262ec954624f531943ff011091102295ae
|
|\ \ \ \ |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Bug: T381042
Change-Id: I9ac5e2f9a4dd003bb4c67a19a391100dd86aef96
|
| |/ / /
|/| | |
| | | |
| | | |
| | | | |
Bug: T340552
Change-Id: I18ffd0e36efbabe82313de685ca8c6c99341c6f3
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Matching other tests in /tests/phpunit/unit/includes/libs/mime.
Follows-up Iccdade8dcd3211b7e2df2e50694da8d97c82b59e.
Bug: T382910
Change-Id: Ib83243a4f86dd4d8b56a9d300e69c6c2caaf3bb7
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Why:
- MimeAnalyzer needs ZipDirectoryReader, but it was not part of libs.
This was a problem because libs code must note depend on MediaWiki code.
Since there seem to be no other users of ZipDirectoryReader, the
simplest solution seems to be to move ZipDirectoryReader into the
Wikimedia\Mime library.
What:
- Moved ZipDirectoryReader and ZipDirectoryReaderError into
the Wikimedia\Mime namespace under includes/libs/mime.
Bug: T382910
Bug: T364652
Change-Id: Iccdade8dcd3211b7e2df2e50694da8d97c82b59e
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If present and valid, connect our root span to the
input parent span.
Bug: T340552
Change-Id: I3530c3b6be95c7b4a8960ad25929f795c4514db0
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Why:
- SpanContext::setAttributes() currently overwrites existing attributes
on each call, instead of merging them.
- This behavior isn't documented and is confusing, especially since
official OTEL clients usually merge attributes.
What:
- Have SpanContext::setAttributes() merge attributes instead of
overwriting the existing ones and add a test for this.
- Document the behavior on the public-facing
SpanInterface::setAttributes() API.
Change-Id: Ib2995c492b503ad84104deab9c227cfb62bffc55
|
| | |
| | |
| | |
| | |
| | | |
Bug: T340552
Change-Id: I7896f6ebee151d7da1d88e04bb4d05dc007d67e8
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make SqlPlatform::tableNameWithAlias() include the unqualified table
name as an alias if doing so is not redundant. This assures that the
default alias from JoinGroupBase::addJoin(), equal to the unqualified
table name, will be usable in SQL (regardless of table prefixes).
Clean up use of identifier quotes for sqlite_master tables. The called
methods expect unqualified names and a passthrough exception already
exists for sqlite_* tables.
Use "block_target.bt_user" directly in ApiQueryBlocks and BlockPager,
instead of using addIdentifierQuotes(). The "block_target" alias is
automatically added to the SQL by the rdbms layer when it's not clearly
redundant, so it is always safe to use block_target.bt_user. Also, there
is no reason for aliases to include quote characters. They are supposed
to be simple alphanumerics like column names. This makes it easy for
tableNameWithAlias() to avoid redundant aliases by checking tableName().
Avoid unneeded quotes around pg_catalog.* table names in the Postgres
installer. The relevant documentation of methods like selectField() is
that the table names be unqualified (no quotes nor dots), though dots
are still supported internally for compatibility reasons and ease of
querying schemas like pg_catalog and information_schema.
Change-Id: Ic7d7826da31f49915141692cb3bd84ed1e872e96
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The label formatting logic was not yet covered by tests.
https://doc.wikimedia.org/cover/mediawiki-core/includes/libs/Stats/Formatters/DogStatsdFormatter.php.html
Bug: T240685
Change-Id: Ie37c4df13acb3631865fc017f6af2cc87b75d28e
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Why:
- Now that we have a basic OpenTelemetry library available in MediaWiki,
we would like to start instrumenting code and propagating the trace
context.
What:
- Start a root span in early setup code once the service container is
available, so that subsequent setup logic (e.g. session
initialization) can already be instrumented.
- End the root span in restInPeace() after the main transaction round
ended, so that the normal LBFactory shutdown process can be instrumented.
- Have TracerSharedState hold the root span throughout.
Bug: T340552
Change-Id: I0785204a6989787a492a08b78c40c6df91106f23
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Why:
- The test ClockTest::testShouldReturnCurrentTime is flaky.
- Ie48d9400cf3bb99467a16b9ea0cce6172e2e2568 recently augmented
the ConvertibleTimestamp library to allow faking hrtime(), which will
be a better solution for this class and test than the current
assertion.
What:
- Skip the test until core is updated to the latest version of
ConvertibleTimestamp.
Bug: T379562
Change-Id: Iae502ed0344f45f89da575f1c5d1e0fb9c1e4dfa
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To avoid a breaking change, introduce a new function name
as CompressionStream is asynchronous.
Once mw.deflate can be removed, we can add skip function for pako
based on the availability of CompressionStream.
Bug: T235237
Change-Id: I722ebb03c0db7c7b3ee16cc8881e41909142cee9
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Validate the @covers annotation to be valid on CI runs.
This is done for mosts tests via MediaWikiCoversValidator in base class
MediaWikiIntegrationTestCase or MediaWikiUnitTestCase
Only omitted when @coversNothing is used.
This is already used in other library-related test cases.
Change-Id: Ib31db02b4c623e80049a5f4645c77824244b6d6d
|
|/
|
|
|
|
|
|
|
|
| |
These cancel callbacks are not used at all.
It is adding a lot of complexity to the transaction management of
rdbms making it quite harder to understand and reason about.
Bug: T363839
Change-Id: I3cb1e30611b83c03535ea87a216bbedd4a911f4e
|
|
|
|
|
| |
Bug: T378876
Change-Id: Iecbf83dd060b2a1dc30bd33bfc4f2a42cfbd2a1f
|
|
|
|
|
|
|
| |
Deprecated in I492edabb7ea1d75774b45eb9fd18261b39963f9f.
Bug: T278482
Change-Id: Ie9350ed0d7b2604fb4d2f440dee66964fe198c0e
|
|
|
|
|
|
|
|
|
| |
This can cause PHP to try to load the param value as a class, with
potentailly disastrous results (though it’s not quite clear if this can
actually cause attacker-supplied code execution or not).
Bug: T377912
Change-Id: I0239b3e65cf516c6fdf287882f05e47a01f963c1
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I27b9a19ab952ede1267921bd042af0fe1c89e228
|