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
Not yet sure if config validation makes sense in production,
possibly before we write into cache we can validate, and then
trust that the cached values are all valid. This patch just
adds ability to validate the configuration.
"justinrainbow/json-schema" is already a transitive dependency
and is already in vendor.
Change-Id: Ib039c897a36a7e1911309fd29514657042b1b139
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
If php-yaml extension in installed, use that. Otherwise
we fallback to symfony Yaml parser.
php-yaml is about 20 times faster then symfony, for default-settings.yaml
it will take PHP-yaml 6ms to load it vs 100ms for symfony. But given
that the result will be cached, it's better not to bring in
a required native dependency.
Bug: T294751
Change-Id: I3ffde926c3f264cacf39810ff7bd338c9f78823d
Changes since 2.2.4:
* Fix minify CLI to work from within vendor directory.
* Remove true/false !0/!1 micro optimisation. (T237042)
Depends-On: Id2f2061ac5c7389840b73ad138a91df73a40877f
Change-Id: I1f437781dd8f0cea516693a6e15fe3f95a0aa2ad
This is required by Parsoid 0.15.0-a6.
I don't need to increment the Parsoid version here since it is
not using semantic versioning. The caret will allow upgrades until the
Glorious Future of 1.0.0.
Depends-On: I72346a431f556555410f6af64bdb10140ea9bd8a
Change-Id: Idefebb725444d244252623533b8469214324f931
This version fixes a flipping bug.
Bug: T288943
Depends-On: Ida34372a4e5acb3147d83c7a1d008850c8382e32
Change-Id: I0528443e4eae0338f5a37491352db03944c6bd4c
This is a bug fix release of RemexHtml, required by the latest version
of Parsoid.
RemexHtml migrated to a new namespace in 2.3.2. Since we don't
support aliases in our phan configuration in core, update all uses to
the new namespace to satisfy phan.
Depends-On: I30f01f4a2a5479bb82c9b952ffa68a478215828a
Depends-On: Iedf446635ee2112cfe637d8ebcf8092f0976bd17
Change-Id: I74fc929e4a66b28bfb1800ff0cd751c86e4a9f50
This is a bug fix release of RemexHtml, required by the latest version
of Parsoid.
RemexHtml migrated to a new namespace in 2.3.2 and uses aliases for
compatibility. Once we upgrade mediawiki-vendor we can rename all
the uses in core and turn off aliases again.
Due to T287419, we need to suppress some phan issues because phan
ends up running against both remex 2.3.1 *and* 2.3.2 in different
CI jobs. These suppressions are removed in the follow up
I74fc929e4a66b28bfb1800ff0cd751c86e4a9f50.
Change-Id: I42edd4fb8cd277ea20e331994fcbe56b52bf3f06
This will use a temporary cache directory for the files analyzed by
phpcs, so that subsequent runs are fast.
Bug: T209149
Change-Id: I15967d220c1dbf9f06551cf4a5d01af5ddb739b6
Dependency was added in T254053 so that we
could use a pimple ServiceLocator in
MediaWikiTestCaseTrait::createSimpleObjectFactory.
But, since the ServiceLocator being created is using
an empty container, its not actually used for anything,
and can easily be replaced with a mock that says
it has no services and throws if trying to retrieve any.
Per the PSR11 spec, the container interface should
throw an exception that implements
NotFoundExceptionInterface - use the
NoSuchServiceException from the Services library
that we use for MediaWikiServices
Change-Id: I721e7417036a8b0fa9084e9d13329262253ae0f6