Why:
- Various tests have been calling Title::clearCaches() on an ad-hoc
basis at the end of test methods, or in tearDown(), to work around
stale Title instances persisting across tests in Title's internal
caches.
- MediaWikiIntegrationTestCase takes care of this since
Ie6cac7e1282f794277dfc8ff3673f12e9969818c, making these calls
unnecessary.
What:
- Remove now-redundant Title::clearCaches() calls from tearDown()
overrides and the end of test methods.
- Preserve in-test Title::clearCaches() calls that are likely
intended to force internal caches to reflect changes happening
within the test itself.
Bug: T395214
Change-Id: Ib5d42389cef20f3839c7f7a80041d002f0f09449
(cherry picked from commit 6483181044496c339ad497cc885319b20de7f6e7)
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead
Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a
Break one long line in SpecialPage.php
Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
We've discovered some new requirements.
Follow-up to 31f614f732.
The hook was not in a release yet, so we can rename it.
Bug: T371530
Change-Id: I82d8ae69c27a38c45eab5d19c063f0b9515b8ec8
This never worked because it looked for `element` instead of `elements`.
The test repeated the same mistake.
Bug: T278576
Bug: T255717
Change-Id: I9bfceb6b8bd761244af6eda0e2ae08e98238aa76
While not documented or tested, aliases previously not only adding
but also replaced values.
Instead, emit a warning to inform skin developers of this conflict.
Note that the `content-links => elements` alias already behaves
this way (only if not already set), which the other aliases would
now be consistent with.
Change-Id: I66ae66b37bba14b2f65710f3d32f17d4e9a5a7a3
* Function alls are either complete on one line or one arg
per line. Avoid confusing calls where the args are on their
own line as this creates visual ambiguity over how many args
are passed, and what each piece belongs to. For example, is
`true` or `false` passed as 2nd arg to applyFeaturesCompatibility?
* Replace comment about list-form behaviour with something that
provides intention and insight instead of merely repeating what
can already be seen from the code.
* Fix malformed `@param` docs that used variable as part of sentence.
* Use named data providers to ease PHPUnit debugging,
and to make code coverage reports on doc.wikimedia.org more useful.
Change-Id: I2efd6cc7ac59c80684c9411025c4226473a36d43
* Move docs for deprecated aliases from top-level mentions into
footnotes under primary docs. Still easy to search for, but no
longer advertised as important for skin devs to know about
or scan past when reading.
* Fix bug in 'legacy' logic where the key was not unset, thus
mandating a needless entry in FEATURES constant. With the bug
fixed, this internal entry is no longer needed.
* Fix bug in 'interface' logic where the key was not unset
when the value is false. This would break the "skins.vector.styles"
module otherwise, and had a similar workaround in place that
is now no longer needed.
* Remove other unneeded entries in FEATURES for keys that were
already being unset by applyFeaturesCompatibility().
* Remove deprecation warnings in favour of letting ResourceModules
give a stable interface from ResourceLoader to skin.json.
* Add missing test to confirm no-op behaviour.
Bug: T374262
Change-Id: I9f4b1d48127d0afe67bada44d8dc4472507f9506
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.
Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.
Change-Id: I90ecf85cb6f639af4be1947ccfbfb16d5b84cab3
We were only showing the development mode warning when Codex was used in
code splitting mode, but not when the full library was being loaded.
Bug: T314507
Change-Id: I22e9707b659b004ef1059f8b13feaf3f61b7ca28
Developers can use this to test their local version of Codex with
MediaWiki by pointing $wgCodexDevelopmentDir to their local clone of the
Codex repo, e.g. $wgCodexDevelopmentDir = '/home/yourname/git/codex';
Setting $wgCodexDevelopmentDir affects where the following things come
from:
- Codex JS/CSS files for the full library
- Codex JS/CSS files for code-split chunks, and the manifest.json file
that points to them
- Icons retrieved by CodexModule::getIcons()
- CSS-only icons imported in Less
- Design tokens imported in Less
Other changes in this patch:
- Add CodexModule::makeFilePath() to centralize the repeated path
concatenation. This makes it easier to switch out the regular path for
the dev mode path.
- Replace all uses of $IP (which is deprecated) and MW_INSTALL_PATH in
CodexModule with the BaseDirectory config setting.
- Make CodexModule::getIcons() reset its static cache if the path to the
icons file changes. Without this, it's impossible to make the unit
tests pass.
- Move the i18n messages code from the CodexModule constructor to
getMessages(). It can't be in the constructor because makeFilePath()
doesn't work there (it fails because the Config object hasn't been set
up yet).
- Add a 'mediawiki.skin.codex' import path so that we can stop
hard-coding the path to the Codex mixins file. Without this, we can't
make the Codex mixins come from the right place in development mode.
- Consider $wgCodexDevelopmentDir in setting the cache key for compiled
Less code, since changing this setting can change the output of Less
compilation (by changing design tokens, icons or mixins).
- Add unit tests for (the non-dev mode behavior of)
CodexModule::getIcons() and the i18n message key handling.
Bug: T314507
Change-Id: I11c6a81a1ba34fe10f4b1c98bf76f0db40c1ce98
Add a hook to StartUpModule that can modify the source URLs
that get embedded into the startup module JS in the form of
mw.loader.addSource() parameters.
The intended use case is preserving relevant URL information,
especially in the case of the 'local' source which is a
relative URL, when the URL pattern of the load.php URL
that generates the startup module code is different from the
URL pattern of the page that loads that load.php URL.
(E.g. $wgLoadScript is set to a different domain than the
current page, to canonicalize load.php URLs for a site
that's reachable via multiple domains, but then by default
the local source is a relative URL which would be
interpreted relative to the URL of the page that executes
the startup module code, so it would result in calls to
non-canonical load.php URLs).
Bug: T365162
Bug: T371530
Change-Id: I199ab779abd0596b836ae43dcc5f2f2a489c9274
Follows-up I0191a812f044a5c04c:
* $installedSkins was named after MediaWiki's SkinFactory and its
return value was not a list of skins, or actually a registry
of skin names and PHP classes (subclasses of "Skin"). This
information is of no use to ResourceLoader as it cannot construct
skin objects (skins would require an RequestContext such used on
index.php).
Change its format to an actual list, and rename to reflect its
local purpose.
* Simplify logic to: If not set, or, we do validation and the
value is not valid.
* Update docs to explain what "perform validation" means.
Change-Id: Ic8544d99055a7b7c7e55496006b5971e4e4fa14f
RL\Context::class depends on SkinFactory to get the installed skins
to check if the skin from the URL is in the list of installed skins
or defaults to 'fallback'.
Most instantiators of RL\Context already have a fallback skin specified
so instead of relying on SkinFactory in the constructor of Context,
let's get the list of installed skins in RL entry point and pass that
instead.
In tests, OutputPage, etc, they're all using a fake request which will
eventually default to the 'fallback' or 'apioutput' or related skin.
NOTE: In ContextTest.php, adjust callers of ::getResourceLoader() to
use `self` instead of `$this` since it's defined as a static method.
Bug: T32956
Change-Id: I0191a812f044a5c04c50c62163395c4a706c375c
The feature would be opt in to retain backwards compatible
support while also moving closer to rendering icons
consistently with how Codex does.
An example of this in use are:
* Ie5c88e0aa243f73f2dc9f310d18fd59b831edc64
* I17fabdf276f6c33fb78c007d75cda6bb9e02d79b
Bug: T365764
Bug: T358246
Change-Id: I95caab8037ccceba73101da2eb3c601f39511377
I believe this makes the code less brittle, and also makes it a bit
more obvious what these strings are meant to represent.
Change-Id: Ia39b5c80af4b495931d0a68fd091b783645dd709
And deprecated aliases for the the no namespaced classes.
ReplicatedBagOStuff that already is deprecated isn't moved.
Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Iae45fa269363be8ee05c598ea6926514ce817762
This patch introduces a namespace declaration for the
MediaWiki\Content to CssContent and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I6ab25787893cb2195f8cd2ba125ed8dd5a60de43
This patch introduces a namespace declaration for the
MediaWiki\Content to JavaScriptContentHandler and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: Ic30789d4e80a27004b6bc3b3ba891a7332a5e1ba
This patch introduces a namespace declaration for the
MediaWiki\Content to JavaScriptContent and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I87c17327911e28a461feaf2ff46242454cff257a
CODEX_MODULE_DIR is always the /modules subdirectory of
CODEX_LIBRARY_DIR, so remove it and derive it that way instead.
- Update tests accordingly
- Rename test data files accordingly
- Use CODEX_LIBRARY_DIR in one place where we had neglected to use a
constant
Change-Id: Ieb347c2d128f3addfb11f6aca79d63969434f342
Remove a bunch of mocking complexity in favour of real pages.
This is in prep for making a better regression test in change
I591ee186083f for T360014.
Bug: T360014
Change-Id: I2f99a542a6d17a8503213f68c3df6a1c5ca50c77
Use TitleValue instead of Title::newFromText to reduce complexity of
this test.
Change `Project:Example/foo.js` example to NS_USER to be more
realistic, given that (afaik) there can't be a WikiModule with a
page in NS_PROJECT. It is true that people sometimes import project
pages containing JS via importScript over action=raw, but that
doesn't involve ResourceLoader.
Change-Id: Id2df9a0f17880e397b02d4c855d9e0287a8949ee
* Remove references to IDatabase from preloadModuleInfo() and with
it the last reference to Rdbms in the ResourceLoader service
(progressing T32956).
* Simplify WikiModule::preloadTitleInfo() so that it doesn't need
an IDatabase object unless
1) there are non-zero WikiModule objects in the batch, and
2) there is a cache miss.
* Remove needless IDatabase parameters passed or mocked for this
method. Note that WikiModule already had `@group Database` set
since each WikiModule::getDB() is called and uses an unmocked
database. The mocked database was only injected to satisfy the
method signature.
Bug: T32956
Bug: T359522
Change-Id: I022f02d6e6bbae46c3258a7c07a1d6723506d8bc
Fixed SkinModuleTest::provideGetFeatureFilePathsOrder as nesting of
arrays for parameters is wrong
Change-Id: I9875008adf62d284c48662ebfbd245d72e5be064
Changes SkinModule::getStyles to output config features
first, then skin customization styles last. This requires
using the ResourceLoader::makeCombinedStyles method to
first combine feature styles, then combine style related styles,
and return the concatenated result in SkinModule::getStyles().
The resulting stylesheet ordering is changed so that all
skin customization styles are always output after core styles,
which allows skins to override core-styles via cascade order instead
of increased specificity.
Previous output order:
- all (core+custom)
- print (core+custom)
- screen (core+custom)
- other custom
New output order:
- all (core)
- print (core)
- screen (core)
- other (core)
- all (custom)
- print (custom)
- screen (custom)
- other (custom)
SkinModule is refactored to separate logo-related style
generation, as well as skin feature generation, in order to maintain
testability. Tests are also refactored to better cover different
skin feature configurations.
Bug: T354975
Change-Id: I261742c0ae4c3d57353bf1854af66f39df6132f7
expectWarning() and friends have been deprecated in PHPUnit 9.6, and
removed in PHPUnit 10. Unfortunately, there is no simple replacement
because PHPUnit no longer converts them to exceptions in the first
place. In fact, Sebastian Bergmann explicitly stated that he does not
consider the use case of
> a library developer to verify a code block warns its consumer when
> certain action is performed
worth supporting.
So, add an ad-hoc replacement for all the deprecated methods. This is
quite ugly, but it's simple enough given the low number of usages.
On the bright side, this new method does not halt the test when the
warning is triggered. This seems to align with the developers'
expectation, seen in a few existing tests, that any code following the
notice will be executed.
Bug: T342110
Change-Id: I214abfed4280834840c115777ed78eb0a5570da9