This uses some reflection to identify if the data provider is static or
not. If it isn't, a deprecation notice is emitted. This doesn't fail the
tests, but is still printed in the output.
To facilitate this, the relevant abstract method has been uncommented,
as PHP does not like it when function signatures do not match up.
This approach means that tests in extensions or skins do not immediately
break when making data providers static. Instead, they can do so at
their own pace.
Bug: T332865
Change-Id: I5ff35ad0e894f0a27beae00257dc1fc599ad518d
This is now enabled in production (Ic5a4a9950d51f63b17f4c5e70516bec87b981aa5)
and not something we want to remain configurable.
It is removed from Parsoid in I52ddfd21ff2e72a34cb5eb68742e3dfb85c6ccf6
Change-Id: I6a4d7d33fb42270fc5da3a922aa0a959180fb33f
The UA sniffs that overrode the feature tests are no longer needed.
* MSIE 10: Fine, rejected by feature checks.
* UC Mini "Speed Mode": Redundant, the version that this sniff
matched is pre-ES6. Current versions of UC Mini don't appear to
support enabling "Speed Mode" on random websites nor does it offer
it for Wikipedia specifically.
Details at https://phabricator.wikimedia.org/T178356#8740573.
* Google Web Light: Redundant, shutdown as of 2022.
Any references or extensions that still reach the proxy, get
redirected to our online URLs
https://googleweblight.com/?lite_url=https://en.m.wikipedia.org/wiki/Bananahttps://phabricator.wikimedia.org/T152602https://en.wikipedia.org/wiki/Google_Web_Light
* MeeGo: Redundant, discontinued and presumed rejected.
Either way, unsupported.
* Opera Mini: Fine, rejected by checks.
Details at https://phabricator.wikimedia.org/T178356#8740573.
* Ovi Browser: Redundant, discontinued and presumed rejected.
Either way, unsupported.
* Google Glass: Improve UX (since 2013, T58008).
* NetFront: Redundant. Old versions are presumed rejected.
Current versions are Chromium-based and presumed fine.
The exclusion was not UX based, but due to jQuery explicitly not
supporting it in 2013. This is no longer the case, so we can let
the feature test lead the way here.
* PlayStation: Redundant, same story as NetFront.
The version that matched the sniff is presumed rejected.
Current versions probably fine, but even not, don't match
our sniff so are already enabled today.
Bug: T178356
Change-Id: Ib6263ce3ffd11af5e501de8857f3e48a248c6210
Follows-up I071be5821711f (2cf45bc934) and I8aeffc1f2e81 (3270283abf).
Avoid use of `@standalone` in core, since that group is only
special-cased in WMF CI for extension and skin repos.
Core tests, unlike extension tests, are already skipped by default
when running PHPUnit in CI for extension and skin repos. The exception
is the structure/ directory which is for general system-wide checks
that may also cover installed skins and extentensions.
Given that this test only covers core, and that's why we want to
skip it, move it out of structure/.
Bug: T203694
Change-Id: I7431e5627861845f9d49afc4777b76052d3a6e77
This will allow us to treat $wgHooks as a normal config
variable in 1.41.
Note: should be backported to 1.40
Bug: T331602
Change-Id: Iddcb760cf8961316d6527e81b9aa968657d8354c
This makes all Codex mixins available anywhere that the skin variables
are imported, so MediaWiki code doesn't need to import these mixins
separately. This also ensures that the tokens are present when the
mixins are used.
Bug: T328602
Change-Id: If2b4073115d9082829e4917c87c167d18f5431d9
This replaces the hacky wrapper files in
resources/src/mediawiki.less/mediawiki.skin.codex-design-tokens/ and
resources/src/medawiki.less/@wikimedia/codex-icons/dist/ with real
import path aliasing/remapping.
Bug: T328602
Change-Id: I2df266cde90d1b8dad8d1d1367b67001e2b2984d
Consolidate cache TTL handling within CoreMagicVariables.
Make the TTL account for how many seconds away the value is from changing.
For example, CURRENTHOUR should change soon after the next hour is reached.
There is a minimum adjustment TTL to avoid parser-after-save delays.
This allows for longer caching in most cases, as well as more up-to-date
rendering when the hour/day/week/year is about to change. Previously, there
were blind TTLs, which are either way too pessimistic or way too generous.
This commit does not change the CURRENTTIME, CURRENTTIMESTAMP, LOCALTIME,
and LOCALTIMESTAMP words, since there is no reasonable way to cache output
while keeping them up-to-date.
Bug: T320668
Change-Id: I9acb42b0d9ff67798a1624cbf9c7cac99c8fbe2f
Extensions or skins might want to define their own tests and not
giving them access to the cached JSON is limiting. Because the
method was private for a reason, make it final to prevent overriding
it and breaking things in weird ways.
Also, now that we are on PHP 7.4, use JSON_THROW_ON_ERROR to allow
PHPUnit to have clearer error messages when extension.json/skin.json
is not valid JSON.
Follows-Up: I47757958e54d5e9d47a309b4037ff47dd9c1d382
Change-Id: I5819da9c59499d1752057f79b1855872064ff32e
This patch enable .woff files with 'font/woff' mime type
and .woff2 files with 'font/woff2' mime type for MediaWiki.
Bug: T309714
Change-Id: I7375ee87c865f22a5539af52fa7dae122d2644b9
Uses flag to detect which cache instance to use based on ParserOptions
and sets the primary and secondary caches accordingly. This ensures
that the ParserCacheMetadata cache used by the ParserCache is also
appropriately forked for Parsoid, as Parsoid may consult different
options in the ParserCache than core does.
A follow up patch will attempt to refactor this to be less
parsoid-specific.
Bug: T327769
Bug: T330677
Co-authored-by: Alangi Derick <alangiderick@gmail.com>
Change-Id: Id580b97ad9a0b90bbe56d4de3c2f999274fe329b
This is an initial quick-and-dirty implementation. The
ParsoidParser class will eventually inherit from \Parser,
but this is an initial placeholder to unblock other Parsoid
read views work.
Currently Parsoid does not fully implement all the ParserOutput
metadata set by the legacy parser, but we're working on it.
This patch also addresses T300325 by ensuring the the Page HTML
APIs use ParserOutput::getRawText(), which will return the entire
Parsoid HTML document without post-processing. This is what
the Parsoid team refers to as "edit mode" HTML. The
ParserOutput::getText() method returns only the <body> contents
of the HTML, and applies several transformations, including
inserting Table of Contents and style deduplication; this is
the "read views" flavor of the Parsoid HTML.
We need to be careful of the interaction of the `useParsoid` flag with
the ParserCacheMetadata. Effectively `useParsoid` should *always* be
marked as "used" or else the ParserCache will assume its value doesn't
matter and will serve legacy content for parsoid requests and
vice-versa. T330677 is a follow up to address this more thoroughly by
splitting the parser cache in ParserOutputAccess; the stop gap in this
patch is fragile and, because it doesn't fork the ParserCacheMetadata
cache, may corrupt the ParserCacheMetadata in the case when Parsoid
and the legacy parser consult different sets of options to render a
page.
Bug: T300191
Bug: T330677
Bug: T300325
Change-Id: Ica09a4284c00d7917f8b6249e946232b2fb38011
* Unnecessary regex modifier. I agree with this inspection which flags
/s modifiers on regexes that don't use a dot.
* Property declared dynamically.
* Unused local variable. But it's acceptable for an unused local
variable to take the return value of a method under test, when it is
being tested for its side-effects. And it's acceptable for an unused
local variable to document unused list expansion elements, or the
nature of array keys in a foreach.
Change-Id: I067b5b45dd1138c00e7269b66d3d1385f202fe7f
* Inappropriate @inheritDoc usage. Arguably all @inheritDoc is
inappropriate but these are the ones PHPStorm flags as misleading
due to the method not being inherited.
* Doc comment type does not match actual argument/return type.
* I replaced "@return void|never" with "@return void" since never means
never, it doesn't make sense for it to be conditional. If a method
can return (even if that is unlikely) then @return contains the type
that it returns. "@return never" means that there is no such type
because the method never returns.
* Incomplete/partial/broken doc tags
Change-Id: Ide86bd6d2b44387f37d234c2b059d6fbc42ec962
* Illegal string offset and invalid argument supplied to foreach, due to incorrect type information
* Array internal pointer reset is unnecessary
* $hookData unused since MW 1.35 due to incomplete revert
* array_push() with single element
* Unnecessary sprintf()
* for loop can be replaced with str_repeat()
* preg_replace() can be replaced with rtrim()
* array_values() call is redundant
* Unnecessary cast to string
* Unnecessary ternary. Often the result relies on short-circuit evaluation, but I find it more readable nonetheless.
Change-Id: I4c45bdb59b51b243fa96286bec8b58deb097d707
* 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
It was decided that deleteJoin() should continue to return void, so the
comment in BlockRestrictionStoreTest and the pass through in
BlockRestrictionStore were not correct.
Change-Id: I634e1e722d25d0cddeb27e051cb0d6da414ee393
Based on GlobalStateFactoryMethodsResourceTest in Wikibase (repo and
client) and EntitySchema; hopefully also useful in other extensions.
Change-Id: I47757958e54d5e9d47a309b4037ff47dd9c1d382
Based on WikibaseRepoTest and WikibaseClientTest in Wikibase; also to be
used in EntitySchema and hopefully other extensions.
Bug: T330628
Change-Id: I6530947aa7c79a7a6437fc09bca8a721285beb15
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
The $modules param is user controlled. We already catch invalid UTF-8
in server configurations. If something like that makes it here, the
only place it can come from is the client doing it intentionally,
such as the result of scanning tools.
Follows-up I89832142b, which silenced $modules formatting in a CSS
response. This patch also covers the case of a JS response, and adds a
test for both.
Bug: T331641
Change-Id: I03a0ec262203509f069654e7fa6fd8d8debd25d5
Can also be used by projects for a policy/recommendations/
to advertise gadget community.
Bug: T311891
Change-Id: Ieee508409843561481da246cf26e0f1d93fea6ed