This avoids the latency of waiting for a response.
Change yieldStampedeLock() to use delete() instead of changeTTL() since
the PECL memcached client does not support WRITE_BACKGROUND with TOUCH.
Also, simply relayVolatilePurges() into relayVolatilePurge() and tweak
some related documentation for WANObjectCache
Bug: T302623
Change-Id: I16f011b730f34332aa54a48c579de3c6606dafda
Follows-up I58ff3c193190d78a. Small step toward not run-time reading
the global (and using Config here is non-trivial/unsafe).
Change-Id: Ic527e493baabe700c50f75fadaa5b51615a5e597
When I deleted MessagesEn.php, neither the exception on line 498 nor
the exception modified here was thrown. Extensions register namespaces,
hiding the lack of default namespaces. If namespaceNames was missing,
RHS line 1004 would raise a warning but would create the key.
Also, phan was complaining that the key might be absent.
So, use 'rtl' instead of 'namespaceNames' as our test for data validity,
since it's less likely to be overridden by extensions. Move the check up
above the normalization of individual keys. Use isset() to satisfy phan.
Bug: T322278
Change-Id: I44c7506205fbe9ba6ffbd1155a6cdcf3ff0960eb
This reverts dc3bd3d721 (I385dca1d95) and re-applies d4ce0f3255 (Ib9fc34ca64).
The CI failures have been addressed.
Bug: T314008
Change-Id: I35a4f656c31b67ebb662bf6f6366f4ee846ecbda
Having pig-latin enabled per default in dev environments is convenient
for manual testing. More importantly, it will allow us to write
end-to-end tests for variant conversion.
Depends-On: I9dc2f743ac487b0f7cfb667150c0f6950d5e7fce
Depends-On: I85b66c85be3959d48a048733af17197bc4cf70af
Change-Id: Ia80ad33cbf5e311fa8b84bd765a8df8d156f4c38
It appears that autoloading classes via MediaWiki's PSR-4 autoloader has
a not insignificant performance penalty, especially when hundreds of
PSR-4 classes like HookRunner's hook interfaces are autoloaded. Using a
classmap autoloader, like we already do for PSR-4 classes from Composer
dependencies, is a potential way to reduce the performance impact
here.[1]
For core classes, this can be done by simply not excluding PSR-4 classes
in AutoloadGenerator, causing it to include appropriate mappings in the
generated autoload.php classmap. I had to exclude one class_alias()
declared in Result.php from the classmap with a NO_AUTOLOAD stanza,
because including it broke AutoLoaderStructureTest's assertion that all
aliases should be defined in the same file as the aliased class.
Assuming this is still an issue, this would already have been a problem
because the test was previously skipping every PSR-4 class. Excluding
this file via NO_AUTOLOAD just restores that status quo.
----
[1] https://phabricator.wikimedia.org/T274041#8358399
Bug: T274041
Change-Id: I0aa62c944d874bf7a9f3a240e72e58fe6a887b28
This restores a rewritten version of
commit 78483caaaf.
- Special:Contribute the default entry point in the menu when enabled
- Otherwise it will link to Special:Contributions (default behaviour)
Depends-On: I65336cfd56e1f6b92c1b3bc83cb5d91bbca065bf
Bug: T319327
Change-Id: I67779b88c4904462f9d847b3edb08a65306b2bfb
* Recognise CachingSiteStore as the internal class that it is.
* Clean up the file header and move ingroup annotation, similar to
other commits under
<https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle>.
The one here was particularly odd as it placed the license inside
the class doc block rather than the file doc block.
* Remove unused $cacheKey and $cacheTimeout constructor args. They
were also not covered by any unit tests.
* Avoid use of `empty()` as per
<https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP>
* Use a more conventional cache key in CachingSiteStore, keeping
the dynamic part for a later segment and keeping the first segment
explicitly tied to a single concrete key group. This also improves
ergonomics of cache statistics e.g. in Grafana and makes the cache
key easier to locate in codesearch/grep, and more recognisable,
e.g. starting with the code component ("site").
Change-Id: I541ad62551ab76127d70ef665272fd1d590ab556
Restore unrelated test fix from 46eabe275c, which got reverted
in 0b43c49465.
The DatabaseFactory::create() function takes $type which is either
a built-in type (mysql, sqlite, postgres) or theoretically the suffix
of a database extension class for a custom type.
"mysqli" is not a valid type, the type is "mysql". This was passing
because DatabaseMysqli still exists as a class alias for the namespaced
Rdbms class.
Bug: T309418
Change-Id: Ic05a4b3d4cfe539e11df3dc83dfe459c184d1332
When visual editor switches from source mode to visual mode, we need to
stash the wikitext. Otherwise, we later lack the proper context to
convert the modified HTML back to wikitext.
Bug: T321862
Change-Id: Id611e6e022bf8d9d774ca1a3a214220ada713285
This allows for large string value storage similar to that
of direct BagOStuff callers.
Bug: T309126
Change-Id: I22d2d8bb520ef2ea6ccd28016d34db36fe27c3df
This patch is intended to allow HtmlInputTransformHelper to be used
without constructing a fake request body. The idea is to make it easier
to use it in action API modules, such as ApiVisualEditorEdit.
Change-Id: I4002342820b19060da30b6fb8622c85c49eec6a0
* We will have several kinds of HTML transformations.
Rename HTMLTransform to indicate that its for converting HTML to Content
objects.
* Using Naming Convention 'Html' instead of 'HTML'
Change-Id: I506f3303ae8f9e4db17299211366bef1558f142c
implementations of ContentHandler::fillParserOutput MUST set HTML if
$cpoParams->getGenerateHtml() returns true.
Bug: T321319
Change-Id: Ibd43f7420e949666649752dce7072dc35bc1f440
The legacy 'rvdiffto' API parameter allows consumers to supply a
revision ID or the special strings 'cur', 'prev', 'next' to
revision-related API modules. This will then be resolved to a revision
and the diff of returned revisions against this revision will be
attached to the response.
On PHP 8.0, this parameter is broken as 'cur', 'prev', 'next' no longer
get resolved to the appropriate revision ID but rather are treated as
invalid literal revision IDs. This is because given an associative array
`$params = [ 'diffto' => 'prev' ];`, the expression `$params['diffto']
!= 0` is false on PHP < 8.0 but true on PHP >= 8.0.[1]
Fix it by also checking whether the parameter value is numeric before
treating it as a revision ID, and add a test case for this logic. To
facilitate testing, convert the counter used by ApiQueryRevisionsBase to
count the number of uncached diffs served in the current response to an
instance variable; it is currently a static variable which persists
across test boundaries.
Change-Id: Ifbe14cd2880c98dddc5577d226bef5878bdd657f
---
[1] https://onlinephp.io/c/81e7b
Bug: T322335
Change-Id: Id5032932842c94f4d3ca3707fbc733f5b9704151
Since the introduction of the new hooks stystem, it is not possible to
clear all hooks by setting $wgHooks. This would only clear old-style
hooks. This is becoming increasingly problematic as the new hooks system
is adopted by more and more extensions.
Introduce a method that allows tests to reset many or all hooks.
This isn't needed much in core, but extension tests need it.
Change-Id: Ica3eb88fe23fe822d2aadb96ff5d15f80dce0d7b
We already depend on this behavior in IndexPager::getNavigationBuilder(),
but it wasn't allowed by the type hints and wasn't covered by tests.
Change-Id: I9343e852dc4610a50adf1c22ed429ec0a40da816
Follow-up to Ic75bd597b210e14612ca3aebb531b659897e8294.
No longer needed after I161dc0159e4372e3478341ee3fbea13b723d9fc1.
This is a public method, but it has not been included in a release
yet, so we can remove it without deprecation.
Change-Id: Ie5eea4d3423136812178747e187771e7cf78e95f
Normalize language code since classes uses underscores.
See tests/phpunit/languages/LanguageClassesTestCase.php Line 55.
Change-Id: Icc5425c41da531c5f403fda525f46451c7b9e3b7
When submitting HTML to transform/html/to/html, the language specified
by the input's content-language header should be allowed to be the
source variant.
It should also be possible to just specify the source variant, and
derive the base language from that rather than the content-language
header or the page language.
Change-Id: I703c112358a921a8b0c9e63b70fd820ae3ea16fc
Avoid expensive SHOW query for sites that were explicitly configured
to use pt-heartbeat but configured without a row SELECT condition.
Reduce excessive code complexity for configuration edge cases.
Remove getLagDetectionMethod() and just use the field instead.
Change-Id: I0d8592fde65d8a143506c55dccd1972a148bd489
Make set() and getWithSetCallback() wrap setMainValue(), avoiding some
duplicate option array resolution logic.
Track set() calls via statsd, now that it can be distinguished from
getWithSetCallback() invocations.
Change-Id: Ia1e7b244b1db3b76314d718b3aea9e6e708235c0
Variant conversion is based on the Accept-Language header. Updated
the HtmlOutputRendererHelper to set the HTTP headers related to
variant conversion.
Bug: T317019
Change-Id: I5e11452f1c531a757e8d860f9c727b5810406bce