This patch was applied to release branches for MW 1.42 in April 2024, and
since ported to MW 1.43 and then MW 1.44 as well. This one-of-a-kind hot
patch will finally discontinue once this lands in the master branch as
part of MW 1.45+ releases.
A small handful of phan fixes make this pass so it can land; the rest
(including fixes rather than suppressions of events here) will happen in
later patches.
Bug: T328921
Bug: T359868
Change-Id: Ica2c11a6243795437ec652923e42ef3bd74a5fd8
A regression in 69ad795df7 caused virtual
files with a versionFilePath to be silently dropped from the version
hash computation. This caused changes in these files to not be reflected
in the version hash of the file.
Bug: T385055
Change-Id: Ibde41f07bb6fa7610660cb5b7a3f7aafbe9d6bd3
(cherry picked from commit bce48b6358cd2176d9fbc9a7c22f008bfbcf73d2)
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
A constant is not a variable. The type is hard-coded via the value
and can never change. While the extra @var probably doesn't hurt much,
it's redundant and error-prone and can't provide any additional
information.
Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
Use
$request->getRawVal( 'key' ) ?? 'default'
instead of
$request->getRawVal( 'key', 'default' )
The ?? is more flexible, avoids a wrong type detection by phan and
avoids the evaluation of the default value if not needed.
Bug: T376245
Depends-On: I3ed6b85c0d117ed7cb3a8b79f73a3eb42977891e
Change-Id: I8b02f9297b76d04e21f8cb9194f3b85631956eca
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 allows them to be used in 'mask-image' rules in CSS (introduced
in e977eea153) even if the image is loaded from a different domain.
It also allows JavaScript code to e.g. draw the images on <canvas>
and read back the pixel data. This should be fine, the images don't
contain any private data.
Bug: T371530
Change-Id: Iec3bdd91ca094e2da5030ac5f16ae96be49bf78e
Providing the function name is often optional from the php code,
but it is needed for better logging, so make it mandatory and let phan
report issues about this.
Bug: T374546
Depends-On: Iaed5489a85a5a6e685829e151436afc94310fbd0
Depends-On: Ie2a1e5052e5b61bbb5b89905de942f47d3f1413d
Change-Id: I5227f2fa65850ac8c6f620900f22d1f4e7bfd470
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
* Corrects the previous deprecation to restore backwards compatible functionality to i18n-all-lists-margins for skin developers without
any change on their part.
* Updates deprecation message to give clearer next steps.
Bug: T369475
Change-Id: I98696b4a52838a4836320a491430e669e3a5d1e1
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
wfUrlProtocols is deprecated since 1.39, let's remove the uses and turn it
into a hard deprecation.
Change-Id: Ic5f827f6e4563bab1b28f090da8f8613b124fcc5
CodexModule::processStyle() looks at the path of the style file to
detect whether it's an already-flipped Codex file. In
I11c6a81a1ba34fe10f4b1c98bf76f0db40c1ce98 we broke this logic so that it
was comparing a full path (prefixed with MW_INSTALL_PATH) to a relative
path (not prefixed), so the detection always failed and we'd flip every
file. For Codex files, this meant we double-flipped the RTL files back
to LTR.
Follow-Up: I11c6a81a1ba34fe10f4b1c98bf76f0db40c1ce98
Bug: T373676
Change-Id: I49f14dcc503a3279362559197f12b2852276fb5e
This touches various production classes and maintenance scripts.
The code should do the exact same as before. The main benefit is that
the syntax avoids any repetition.
Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
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
Previously, ResourceLoader's CodexModule class was using a hard-coded
list of message keys to add to the payload any time Codex components
get used. But now we can get the list of messages directly from
Codex. This change replaces the hardcoded list of strings with
a call to file_get_contents().
The list of messages is defined in a file called "messageKeys.json"
in the Codex package. In the next release of Codex, this file will
be pulled in via foreign-resources.yml; for now it has been added
manually to the Codex files in resources/lib.
Bug: T371330
Change-Id: Ib7ca66d67153dfba72d8d49b0181d49b007eedce
ResourceLoader currently declares styles are generated only if
Less is involved but RTL CSS styles are also generated in the
same way so let's treat them the same.
This makes RL's debug mode matching better with non-debug mode
so if a user uses ?debug=1 in an RTL wiki, they get CSS Janus
transformed styles just as if Less was involved.
I was seeing the issue for years but had to get to the bottom
of it in I6c9544d7eee3b5885f4fd30265e906fe22a8c223 as this
bit was part of the confusion I had to debug the issue there.
Change-Id: Ib10bec85da969881be590e3d95d5f9474f2eb6e9
* Make 'manageForeignResources.php make-cdx' write the CycloneDX
file to resources/lib/foreign-resources.cdx.json.
* Commit resources/lib/foreign-resources.cdx.json
* Add a structure test to ensure it is up to date.
Bug: T363589
Change-Id: I1e9d53590d4e7f0577d21cd51d777daf62d1f589