Removed use of Psr\SimpleCache\CacheInterface in favor of BagOStuff, as
the latter is a tried-and-true abstraction and the former offers no real
upfront benefits since the caching patterns of SettingsBuilder are quite
basic at this time.
The simplicity of cache interface use is largely in part to the minimal
probabilistic stampede protection implementation within CachedSource
which is left untouched by this change.
Bug: T294748
Change-Id: Ie59b37a8d5c7bf96225757fa9eb9d2c762476713
This is the same functionality provided by `npm test:size` in Minerva
and Vector skins, but as a structure test. Any extension/skin that
provides bundlesize.config.json containing an array of expected gzipped
sizes and module names will be processed by this test.
See also WikimediaMaintenance's blameStartupRegistry.php for similar
code.
Bug: T255149
Change-Id: Ieb7591f3c0ac843677a2a61b4ad47f920fc2ca2d
The `SettingsBuilder` now accepts a PSR-16 cache interface with which to
store and query settings before attempting to load from each source. By
default, no cache is used, but any object that implements the
`Psr\SimpleCache\CacheInterface` may be provided to the constructor.
An explicit dependency on "psr/simple-cache" has been added to
`composer.json`. Note that this dependency already existed in vendor
albeit it as a transitive one.
An APCu based `SharedMemoryCache` adapter is provided as a canonical
PSR-16 compliant interface for production use.
Sources are now queued by the `SettingsBuilder` when calling `load()`.
If a cache interface has been provided, and the source is considered
cacheable (implements `CacheableSource`), then it is wrapped as a
`CachedSource` which will query the cache first before loading from the
wrapped source.
Cache stampedes are mitigated using probabilistic early expiry. The
implementation for this was partially based on symfony/cache-contract
source code but also from the Wikipedia article and paper referenced
therein.
See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration
Bug: T294748
Change-Id: I52ab3899731546876ee58265bd4a1927886746dc
Since 1.34 setting non-default HTTP engine
has been deprecated. It's time to remove
the old implementations. Only Guzzle is
now available.
Change-Id: I978b75827e69db02cbc027fe0b89a028adfc6820
CommentParser:
* Move comment formatting backend from Linker to a CommentParser service.
Allow link existence and file existence to be batched.
* Rename $local to $samePage since I think that is clearer.
* Rename $title to $selfLinkTarget since it was unclear what the title
was used for.
* Rename the "autocomment" concept to "section link" in public
interfaces, although the old term remains in CSS classes.
* Keep unsafe HTML pass-through in separate "unsafe" methods, for easier
static analysis and code review.
CommentFormatter:
* Add CommentFormatter and RowCommentFormatter services as a usable
frontend for comment batches, and to replace the Linker static methods.
* Provide fluent and parametric interfaces.
Linker:
* Remove Linker::makeCommentLink() without deprecation -- nothing calls
it and it is obviously an internal helper.
* Soft-deprecate Linker methods formatComment(), formatLinksInComment(),
commentBlock() and revComment().
Caller migration:
* CommentFormatter single: Linker, RollbackAction, ApiComparePages,
ApiParse
* CommentFormatter parametric batch: ImageHistoryPseudoPager
* CommentFormatter fluent batch: ApiQueryFilearchive
* RowCommentFormatter sequential: History feed, BlocklistPager,
ProtectedPagesPager, ApiQueryProtectedTitles
* RowCommentFormatter with index: ChangesFeed, ChangesList,
ApiQueryDeletedrevs, ApiQueryLogEvents, ApiQueryRecentChanges
* RevisionCommentBatch: HistoryPager, ContribsPager
Bug: T285917
Change-Id: Ia3fd50a4a13138ba5003d884962da24746d562d0
addGoodLinkObj() has many optional arguments, but omitting them actually
means corrupting the cache.
Nearly all existing callers are in tests.
So LinkCacheTestTrait::addGoodLinkObject() was created only
for testing. It is better to have this method in the
trait, because building the row directly in each test
would make these tests brittle against schema changes.
The only usage in WMF production code was in WikiPage and has been
fixed.
Bug: T284955
Change-Id: I03a2bd9ed64fcc0281ee29a286c8db395a9e03d9
Non-mcr storage is no longer supported, so there's no value
in keeping a superclass and a subclass.
Bug: T285460
Change-Id: I008ea30405dac990705966302a06c0957ffe497b
Following soft deprecation in 1.31, hard deprecation
in 1.35, and removal of remaining deprecated uses,
the entire Revision class, and the tests for it, can
now be removed. This will be followed by a patch to
clean up old references in comments - this is just
dealing with the code.
There were some other tests in RevisionDbTest.php
for Title::getNextRevisionID and Title::getRelativeRevisionID,
which could have been kept, but since those methods are
tested separately in TitleTest, no need to keep these, so
just remove the entire file.
Also remove the RevisionTestModifyableContent and
RevisionTestModifyableContentHandler classes that were
only loaded for use in RevisionDbTest - not sure how
the stable interface policy applies to classes that
are only loaded within tests, so mention that in the
release notes as a breaking change.
Bug: T247143
Change-Id: I05a297d28b85c7413384979f5c908be318098d9d
Create new SessionProviderTestTrait and
SessionProviderTestTrait::initProvider method. Replace uses of
SessionProvider::init with new method in tests.
Bug: T283709
Change-Id: I2770188faf3e4f374f9df885ff4deff7189063fc
Create new AuthenticationProviderTestTrait and AuthenticationProviderTestTrait
::initProvider method. Replace uses of AbstractAuthenticationProvider::init with new method in
tests.
Bug: T282781
Change-Id: Ie65c7558bfbacbf6678eea77e4a9b2cf68026456
Shared trait to create services in unit tests to reduce
the mocking needed, beginning with a mock WatchedItemStore.
While this doesn't have everything a full WatchedItemStore(Interface)
supports, it does properly handled the following methods
* getWatchedItem
* addWatch
* removeWatch
* isWatched
* isTempWatched
and properly differentiates between different users and titles,
something the existing mocks in WatchActionTest and
WatchlistManagerTest did not.
Change-Id: I487354542f5322478b9e2c0383cad86453bd5f3e
No integration needed, except for maybe in
the tests for the UploadedFile* classes, which
are left where they are for now - those tests
deal with the file system.
Change-Id: I4f38557d524b2d36dea36a926d0f31e1afed5c7a
Its a test for the ObjectFactory code that is underlying
the ContentHandlerFactory class, but that code is already
tested elsewhere extensively - these tests add nothing
for the library, and don't cover the actual ContentHandlerFactory
code either.
Change-Id: I74a141d592a2582be8f6b2b81a392e5eebc27ec4
The two hooks were moved to a PHPUnit extensions which uses hooks. The
rest was simply deleted. The reason for this change is that TestListener
was removed in PHPUnit 9, with PHPUnit hooks as replacement.
No hooks exist for startSuite/endSuite, plus we should avoid adding too
much functionality: if the output of PHPUnit isn't clear, that should be
reported upstream. Additionally, PHPUnit hooks were also deprecated in
PHPUnit 10, which means that extending PHPUnit becomes more and more
difficult. As such, the two hooks will be hard-deprecated & removed
soon.
Removing all these wfDebugLog and other function calls should also
hopefully speed up the suite.
Bug: T243600
Bug: T225730
Change-Id: I2b67cd0074aca4b0ea76696ce9f24be68f5f88f8
This introduces a specialized SelectQueryBuilder for
queries related to actor table. So far it's fairly basic,
but in future it is intended to grow.
This patch only introduces the new abstraction, using
it will be separated into separate patches.
Bug: T274223
Change-Id: Ibb1c58016e3956a46bfaf1a9f51f265114bb9ace
The functionality of creating title mocks is generally useful
and this will also allow to make HandlerTestTrait more narrow.
Bug: T264058
Change-Id: I76eca48dfcff65a6203fccde5366912a2d66c495
This allows us to move Parsoid-specific extension code from the
Parsoid repo into the extension's own repository and still have
Parsoid parser tests run on it via core's mechanism for running
extension tests.
Factored out some common ParserOptions setup into a common helper
function. There are a number of features still missing from the
Parsoid test runner, which are marked with @todo comments and
phab task numbers.
Bug: T254181
Change-Id: Ifaf53862b96e9127d8f375ad8dd0cc362cba9f5b
Extracts a specialized subclass for rendering the current revision
from PoolWorlArticleView, which then no longer knowes about caching.
In the next step, we will add a subclass that implements caching for old
revisions.
Bug: T267832
Change-Id: I56fb365962951e6c723a01cf9243dbc0094b5581
One major difference with what we've had before is that now we
actually write class names into the serialization - given that
this new mechanism is extencible, we can't establish any kind
of mapping of allowed classes. I do not think it's a problem
though.
Bug: T264394
Change-Id: Ia152f3b76b967aabde2d8a182e3aec7d3002e5ea
CacheTime::mUsedOptions and ParserOutput::mAccessedOptions
do exactly the same thing and has to be merged into a single property.
This patch adds forward-compatibility and needs to be deployed
at least one train before the patch which actually merges the properties.
Change-Id: Ic9d71a443994e2545ebf2a826b9155c82961cb88
Add
- ContentModelChangeConstraint
- EditRightConstraint
- ImageRedirectConstraint
- ReadOnlyConstraint
- UserBlockConstraint
- UserRateLimitConstraint
Additionally:
- Split EditPageTest into a separate file for
all of the constraints being tested
- Add a helper EditConstraintTestTrait
- Add debug logging for EditConstraintRunner for
the result of each constraint
- Changed the order of some of the checks, which
may result in a different failure code if multiple
checks were going to fail, but shouldn't change the
overall result of whether an edit fails or not.
Bug: T157658
Change-Id: Ib8f8b62b9928544e5559c96d82bf850dd8cf9b05
MW 1.35+ only supports PHPUnit >= 8.5; these traits can now be removed
as previously advertised.
Bug: T192167
Change-Id: I84694e32c06f1f0f9fb8398b1f2b92d3df599ddb
This reverts commit c17ddfd786.
This time, also: Trying to get mock http to work in parser test
Bug: T262443
Change-Id: Id708cdfa3d3c27f30543c6bf212df96e6b0a69e1
Based on Daniel's work at Ia6e70179b7ee5ce4e93888585ccc30d92da165c3
however was changed enough to move into a separate changeset.
More acceptance tests and data will be added in a followup commit.
Bug: T264397
Change-Id: I135187e83cbfa02b97c5656f0752f8bf1ceb58d0
MockHttpTrait can be used by tests that need to simulate HTTP requests.
Bug: T262443
Needed-By: I1832cb1858ef4cf42ec34cb7fda509ce5b951c27
Needed-By: I390856b4609635cee22253071f21ce63ff716791
Needed-By: Iff24b55dfaf7a4e02a4c80aaeaf0366de5660ef1
Needed-By: Ia8213725839e4b697c4985060bc35593fea622bc
Change-Id: I8ce17da7315b87b8dd0e502e601b9ac488089456