| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| | |
Follows-up I0da531349d7627970.
Change-Id: I5bde0000e2dbd72f4aa88d95f06dd3c7af3be83e
|
|/
|
|
|
|
|
|
|
|
|
|
| |
Why:
- code under include/libs must not depend on MediaWiki code
What:
- replaced DeferredUpdates with a callback
- replaced MWTimestamp with ConvertibleTimestamp
Bug: T382910
Change-Id: I85bc06364af65bdd5a4e16474ad8a6f644d4f940
|
|
|
|
|
|
|
|
| |
Changes to the use statements and some additions
are done automatically via script
This also updates @covers tag for the namespaced classes
Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
|
|
|
|
|
| |
Bug: T353458
Change-Id: I49c843c9d8f6459c0fbf774afeea7a82fa564b59
|
|
|
|
|
|
|
|
|
| |
And deprecated aliases for the the no namespaced classes.
ReplicatedBagOStuff that already is deprecated isn't moved.
Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
|
|
|
|
|
|
|
|
|
| |
This patch introduces a namespace declaration for the
MediaWiki\FileBackend to FileBackendGroup and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: Id33b6bfa56131978900199786b0082481c6c54a5
|
|
|
|
|
|
|
|
|
| |
This patch introduces a namespace declaration for the
Wikimedia\FileBackend to FileBackend and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: Id897687b1d679fd7d179e3a32e617aae10ebff33
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Every Wednesday, we get hundreds of user-visible storage failures,
because there is only one global storage token and it has a lifetime of
one week. The code assumes that requesting a token regularly will avoid
expiry, but that is not the case.
So, when a request fails with a 401, refresh the auth token, then retry
the request. Factor out HTTP request handling to allow this.
Swift gives us the remaining lifetime of the token in seconds, so use
that as the server and process cache expiry time. There will be a
stampede when it expires, but my laptop can do 700 req/s single-
threaded, so it should be OK.
Add tests to cover the cases previously handled by checking the return
value of getAuthentication().
Bug: T358830
Change-Id: If9fe4dde4127592adae1b81e8eb925c4f59443d9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
FileBackendIntegrationTest was running tests against different backends
in an unconventional way, using a combination of wrapper test cases that
run tests against two different classes, and CLI options which don't
really exist anymore and have an associated fixme.
So:
* Move the bulk of FileBackendIntegrationTest to a new abstract base
class under tests/phpunit/integration.
* Add subclasses for the FS and multiwrite test cases. This allows us to
eliminate the wrappers.
* Add a subclass for MemoryFileBackend.
* Add a Swift subclass which replaces the main use case for
the CLI option --use-filebackend. It is automatically enabled when
a Swift backend is configured, similar to PostgreSQL tests.
* Some miscellaneous tests with a medium level of integration, not
requiring backend setup and teardown, were moved to new classes
FileBackendMultiWriteTest and FileBackendStoreTest.
Change-Id: I0da531349d7627970a7bcb34f3c1f5fd7e05cb21
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's possible to run FileBackendIntegrationTest against an actual Swift
server, but there were a few failures when I tried it:
* In SwiftFileBackend::getDirListPageInternal(), fix a PHP warning due
to strpos(null).
* In setUp(), fix exception "Backend domain ID not provided" due to
missing domainId parameter.
* In doTestGetLocalCopyAndReference404(), getLocalCopy() on a sharded
backend for a file that cannot exist, due to having no shard, returns
null not false, which I think is fine. Use a path that can exist so
that the assertion passes.
* In doTestGetFileList(), there is an assertion to confirm that
getFileList() on a non-existent container will return null, but in
Swift this is not known until iteration begins, so it returns an
iterator. Fix the assertion.
Change-Id: If3fc47eb285b51366e7cfd8b6cf6e64bd0f8cd41
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces the old pass-by-reference $predicates array and makes the
intent clearer. It also supports lazy-loading of predicated properties,
which useful for avoiding expensive computations like SHA-1 hashes when
they end up not being needed.
Pass FileOp::doPrecheck() a mutable "batch level" FileStatePredicates
instance along with an immutable "operation level" FileStatePredicates
instance. The later can be used in callbacks that need to recall the
predicated file states just before the start of the operation.
Make FileOp::precheckDestExistence() support lazy size/sha1 closures.
Bug: T348294
Change-Id: I709c1920d2bee4b76f69e38c1643a44a73d63265
|
|
|
|
| |
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
|
|
|
|
|
|
|
| |
DBLockManager was removed in MW 1.40
Follows-Up: Id7e3fde02dfca02271bcec039be5c079de9de830
Change-Id: I8f911e8bc7efb6c2a7a9b55f93aa807f4cd33825
|
|
|
|
|
| |
Bug: T353247
Change-Id: I5cb64d8bce1c7f80830fc07a5fd1a427082f1463
|
|
|
|
|
| |
Bug: T166010
Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
|
|
|
|
|
|
|
|
| |
For example:
* assertStatusGood = ok without any errors or warnings
* assertStatusWarning = ok, but not good, i.e. there is a warning
Change-Id: I4b3ec7a3c5b028c0505e1371c297a9c47e448b42
|
|
|
|
|
|
| |
Most noisily, this enables MediaWiki.Arrays.OneSpaceInlineArray.
Change-Id: I8ab11399c67ce7e3ab1b6249b591452774393428
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, we have two services: ReadOnlyMode and
ConfiguredReadOnlyMode. The former takes the latter and can easily
support every functionality of CRO. I added methods to support that
functionality (the current class is quite small so it's not adding a lot
more to a monster class) and basically fully deprecate the service
itself to improve developer experience.
It is only called in two extensions in production with straightforward
fix so I directly went with hard-deprecation.
Bug: T343917
Depends-On: Icec0ad3f30c471b428efe80dfb9129f55a351194
Change-Id: I421fd5c8fee7af41c059419c2bbc85b8dccc04ed
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
FileBackend::getLocalReference and FileBackend::getLocalCopy should
report failure and missing with different values to make error reporting
for the caller easier (FileBackendStore::doConcatenate in this case).
The existing subclass implementation for
FileBackendStore::doGetLocalCopyMulti already doing that.
Change-Id: Ie29aed48dc33bcd9fe1ed1e91685596044dfd988
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows-up I4c7d826c7ec654b, I1287f3979aba1bf1.
We lose useful coverage and spend valuable time keeping these accurate
through refactors (or worse, forget to do so). The theoretically "bad"
accidental coverage is almost never actually bad.
Having said that, I'm not removing them wholesale (yet). I've audited
each of these specific files to confirm it is a general test of the
specified subject class, and also kept it limited to those specified
classes. That's imho more than 100% of the benefit for less than 1%
of the cost (more because `@covers` is more valuable than the fragile
and corrosive individual private method tracking in tests that
inevitably get out of date with no local incentive to keep them up to
date).
Cases like structure tests keep `@coversNothing` etc and we still don't
count coverage of other classes. There may be a handful of large
legacy classes where some methods are effectively class-like in
complexity and that's why it's good for PHPUnit to offer the precision
instrument but that doesn't meant we have to use that by-default for
everything.
I think best practice is to write good narrow unit tests, that reflect
how the code should be used in practice. Not to write bad tests and
hide part of its coverage within the same class or even namespace.
Fortunately, that's generally what we do already it's just that we
also kept these annotations still in many cases.
This wastes time to keep methods in sync, time to realize (and fix)
when other people inevitably didn't keep them in sync, time to find
uncovered code only to realize it is already covered, time for a less
experienced engineer to feel obligate to and do write a low quality
test to cover the "missing" branch in an unrealistic way, time wasted
in on-boarding by using such "bad" tests as example for how to use
the code and then having to unlearn it months/years later, loss of
telemetry in knowing what code actually isn't propertly tested due to
being masked by a bad test, and lost oppertunities to find actually
ununused/unreachable code and to think about how to instead structure
the code such that maybe that code can be removed.
------
Especially cases like LBFactoryTest.php were getting out of hand,
and in GlobalIdGeneratorTest.php we even resorted to reminding people
with inline comments to keep tags in sync.
Change-Id: I69b5385868cc6b451e5f2ebec9539694968bf58c
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Triple backslash in regex should really be quadruple backslash
* Using the returned value of a void method
* Immediately overwritten array keys
* Duplicate array keys
* Foreach variable reuse
* sprintf() with too many params
* Incorrect reference usage
Change-Id: I3c649b543c9561a1614058c50f3847f663ff04df
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.
Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.
Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
|
|
|
|
|
|
|
| |
And WikiReference
Bug: T321882
Change-Id: I60cf4b9ef02b9d58118caa39172677ddfe03d787
|
|
|
|
|
|
|
|
|
| |
- Declare missing properties
- Remove unused or avoid set of properties
- Add AllowDynamicProperties
Bug: T314099
Change-Id: Ie631894f2ffbb616f6dd09851405d681f3eb8fcd
|
|
|
|
|
|
|
| |
assertSame avoids use of loose comparisons and
allows to check the expected type
Change-Id: If821d1be2bc1ff9f8b70968a339f33c7a8e8880a
|
|
|
|
|
|
|
|
|
|
| |
This obscure class could only be used by running file_locks.sql and
customizing $wgLockManagers. It was not worth the overhead of having
to maintain it.
Remove DBLockManager since there are no subclasses now.
Change-Id: Id7e3fde02dfca02271bcec039be5c079de9de830
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
And also assertNotRegExp -> assertDoesNotMatchRegularExpression. The
methods were renamed in PHPUnit 9.
Done automatically with:
grep -rl assertRegExp tests/ | xargs sed -r -i "s/>assertRegExp\(/>assertMatchesRegularExpression\(/"
grep -rl assertNotRegExp tests/ | xargs sed -r -i "s/>assertNotRegExp\(/>assertDoesNotMatchRegularExpression\(/"
Split out from Ifdba0f9e98eb6bce4590b7eb73170c51a697d7c6 so that it
remains smaller and easier to review.
Also make a test use MediaWikiUnitTestCase (it's already in the unit/
dir) so that it can access the forward-compat method.
Bug: T243600
Change-Id: Ifa279d5f201d7abeebece292141ebface8278046
|
|
|
|
|
|
|
|
|
| |
Make use of `overrideConfigValue(s)()` where needed and also
make use of MainConfigNames constants.
NOTE: group multiple calls to setMwGlobals() to one and pass
an array of values instead.
Change-Id: I3bbfd037bb3765c00c426682cce3ef5cccc1a284
|
|
|
|
|
|
| |
overrideConfigValues is documented to reset services as well
Change-Id: Ie13a699f6cd912b912d34adb97704bab3cbdff2d
|
|
|
|
| |
Change-Id: I13a82dc57a86f74c713a11eff26488bee06903e2
|
|
|
|
|
|
| |
… instead of doing the same manually with anythingBut() and such.
Change-Id: Idb66040d1560a82df9a5bfa2a6c7e20a0649e49c
|
|
|
|
|
|
|
| |
This ensures that assertions work in a uniform way,
and provides meaningful messages in cause of failure.
Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
|
|
|
|
|
|
|
| |
All deployed usages have been migrated.
Bug: T255493
Change-Id: I82683596d644bb61a109e79dde6b0cb22c72b399
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows-up I361fde0de7f4406bce6ed075ed397effa5be3359.
Per T253461, not mass-changing source code, but the use of the native
error silencing operator (@) is especially useful in tests because:
1. It requires any/all statements to be explicitly marked. The
suppressWarnings/restoreWarnings sections encourage developers to
be "lazy" and thus encapsulate more than needed if there are multiple
ones near each other, which would ignore potentially important
warnings in a test case, which is generally exactly the time when
it is really useful to get warnings etc.
2. It avoids leaking state, for example in LBFactoryTest the
assertFalse call would throw a PHPUnit assertion error (not meant
to be caught by the local catch), and thus won't reach
AtEase::restoreWarnings. This then causes later code to end up
in a mismatching state and creates a confusing error_reporting
state.
See .phpcs.xml, where the at operator is allowed for all test code.
Change-Id: I68d1725d685e0a7586468bc9de6dc29ceea31b8a
|
|
|
|
| |
Change-Id: I361fde0de7f4406bce6ed075ed397effa5be3359
|
|
|
|
|
|
|
|
|
|
|
|
| |
Expected value is the first parameter to assertSame() or assertEquals().
And turn to use assertCount() for some assertions aginst count of array.
Based on code search `assert(?:Same|Equals)\(.+,.+expected` and I look
through files roughly, so some assertions that don't contains 'expected'
are also fixed. In the meantime, some assertions that I am not clear
about are not touched.
Change-Id: I75798b60d29fd19b33f4fdf34ed3c788db420d01
|
|
|
|
| |
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
|
|
|
|
|
|
|
|
| |
Yes, it's a micro-optimization. See https://bugs.php.net/bug.php?id=78285
and https://thephp.cc/articles/caching-makes-everything-faster-right
for more info.
Change-Id: Ib8e8e9794e15066476f35cdb1236df8b983274d6
|
|
|
|
|
|
|
|
| |
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().
Bug: T298059
Change-Id: I22d96b7aec17323d15a9bc401d4511ad2ee14165
|
|
|
|
|
|
|
| |
The feature was introduced in 2012 with d19f54602f (just before
the gerrit migration).
Change-Id: Ia3f59ad0ddeb1f610947b14e22b0694ff4c6ed84
|
|
|
|
|
|
|
| |
both deprecated since 1.34.
Bug: T249030
Change-Id: Ide18730c12af503259c98a0380e34a075ecd7128
|
|
|
|
|
|
|
| |
both deprecated since 1.35, hard deprecated since 1.37 and unused.
Bug: T249025
Change-Id: Ie4759fa3fa25202d623317acb444079f10e33817
|
|
|
|
| |
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
|
|
|
|
|
| |
Bug: T254646
Change-Id: I68198bc39b174ea1920b4acc2617cb6c6ce406e9
|
|
|
|
|
|
| |
Plus fix a typo
Change-Id: I8ca326990559ea80254ce0cef2ed204590716679
|
|
|
|
|
|
|
| |
both deprecated since 1.35.
Bug: T249025
Change-Id: I271187e8c5ad68459cfad4c0966c8c14d225512f
|
|
|
|
|
|
|
| |
both deprecated since 1.34.
Bug: T249030
Change-Id: Ic8747430dae6d9ebe8ca52841cf0d998968dfc2f
|