| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Bug: T208477
Change-Id: Ic7c1b02d6d6c077981599f00e443d157648a1fd8
(cherry picked from commit b3b415eb1c2d7c8ecfd7c2422d6d95f2ca39c7a8)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change cleans up when and how we register autoloader info for
extensions.
This bumps CACHE_VERSION to 8, to avoid issues in case this patch gets
reverted: the new code doesn't copy the map of class files into
$info['globals']['AutoloadClasses']. If old code was to read a new cache
entry, autoloading would fail.
BREAKING CHANGE: The following methods have been removed from
ExtensionRegistry without deprecation and without replacement.
They had been introduced in 1.35 for use in the testing framework,
and were not in use by any known extension:
- exportAutoloadClassesAndNamespaces
- exportTestAutoloadClassesAndNamespaces
NOTE: breaks the hack that SocialProfile has in place for T243861.
Bug: T240535
Change-Id: I6e1ceac034c443d9475f1adc1babecddd6af6d05
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader itself.
Move the tests by analogy.
I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".
I did not address DependencyStore which continues to have a non-standard
location and namespace.
Revert of a241d83e0a6dabedf.
Bug: T308718
Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit e08ea8ccb9932f9924a613056afcb2d01c8c7b39.
Reason for revert: Breaks Phan in extensions, and as far as I’m aware,
this change isn’t urgently needed for anything, so the simplest fix is
to revert it again for now. After PHP 7.4 it should be safer to try this
again (we hopefully won’t need the two “hack” classes by then).
Bug: T308443
Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader and
ResourceLoaderContext.
Move the tests by analogy.
I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".
I did not address DependencyStore which continues to have a non-standard
location and namespace.
Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
|
|
|
|
|
|
|
|
|
| |
This introduces static methods for registering classes and namespaces,
so we don't have to mess with global variables and static members
fields.
Bug: T240535
Change-Id: I1abb27bd70898d04c9253e0b7467447fa96d15a4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now largely automated:
VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
$(grep -ERIl "'($VARS)'" includes/)
Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:
vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
$(git diff --cached --name-only --diff-filter=M HEAD^))
I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.
Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add services and utilities for automatic creation of temporary user
accounts on page save, in order to avoid exposing the user's IP
address.
* Add $wgAutoCreateTempUser, for configuring the system
* Add TempUserConfig service, which interprets the config.
* Add TempUserCreator service, which creates users during page save as
requested by EditPage. With proxy methods to TempUserConfig for
convenience.
* Add table user_autocreate_serial. Table creation is necessary before
the feature is enabled but is not necessary before deployment of this
commit.
Bug: T300263
Change-Id: Ib14a352490fc42039106523118e8d021844e3dfb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
getLazyLoadedAttribute() accounts for about 3% of load.php CPU usage in
production, mostly because each ResourceLoaderFileModule calls it for
SkinLessImportPaths, and makeCacheKey() is quite slow.
So, cache lazy attributes in a process cache. There was already
$this->lazyAttributes, which was unused since the original commit. I
assume it was meant to be used for this, so I used it.
I also added a process cache for makeCacheKey() which is invalidated
when the queue changes, so that requests for different lazy attributes
in the same request will be fast.
Change-Id: I83d22b58bb9bf5d06d934d5d2eef8ae7d5f72857
|
|
|
|
| |
Change-Id: I0748e0d5962fa909fdd6b7fcae4ab259bde4cdf1
|
|
|
|
|
|
|
|
|
| |
The deprecation warning shows on all skins which makes it hard
to debug.
Follow up to d3eda44
Change-Id: I067715df10a0b92665623a798c6c95386822a06e
|
|
|
|
|
|
|
|
|
| |
Trying to declare a Parsoid extension showed a couple of issues related
to the JSON specification (there was a possible confusion between both
object declarations) and in trying to declare an extension as a single
string. This patch fixes both these issues.
Change-Id: I8c2f901e9a7e51704f10c8d8754cc8738079fde6
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Extensions can now define namespaces as non-includable, corresponding to
$wgNonincludableNamespaces.
By default, namespaces are includable and need to explicitly be
specified as `"includable": false` to be added to
$wgNonincludableNamespaces.
Bug: T277210
Change-Id: I85dc7bf01e5af81673c745a21ac83168321d0fef
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Warning now issued since skins have been updated.
Additional change:
Previously deprecations in release notes were in the wrong
section (Relating to ResourceLoaderSkinModule) these are
moved alongside the newly added deprecation note alongside
other skin deprecations.
Bug: T262067
Depends-On: I52bee67732cc72ec6857b6fc10cfbdd89ef9b8db
Depends-On: I338198878e78cb5c6f47c53fdf18d3944655e965
Change-Id: Ic60524fe3c054706dbea15cc04235e979952e9f5
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If a new manifest version would be published, this could end in a
regression if the corresponding if statements are forgotten to be
updated. If there is no breaking change in some area, the code from
manifest_version 2 should still be used. Therefore it makes sense to set
these if statements for all versions greater than 2 as well, to prevent
that when a new version is released, the code of version 1 is used.
Change-Id: I0a9feda19cec5be07e6ad0f46fef8c3140f14eca
|
|/ /
| |
| |
| |
| |
| |
| | |
Addition and remove of suppression needs to be done with the version
update.
Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When originally introduced, a skin's templateDirectory was relative
to core, rather than the skin itself. Most skins needed to set
something like "skins/Example/templates", hardcoding the default value
of $wgStyleDirectory.
skin.json will now assume that the value of templateDirectory is
relative to the skin itself. If that directory doesn't exist, we'll
fallback and assume it's using the previous behavior of being relative
to core. In practice this should not be a breaking change since no skin
is expected to have a directory like "skins/Example/templates" inside
the skin itself.
Finally, ExtensionProcessor will set a default templateDirectory if
one isn't already set, so in most cases this setting should be able
to just be removed entirely.
Bug: T262067
Change-Id: I434b8a4319f3c8b65bcaab3465224058f31e7ae8
|
|
|
|
|
|
|
|
|
| |
The non-strict conditions in if/while are true/false without the check.
In some situation the true/false is removed, because it is known to be a
bool (by is_bool check or type hint)
Change-Id: I5ca4c4771af25d2e785e82732df204a73653886e
|
|
|
|
|
|
|
| |
Some minor updates I collected in my local dev environment the
past months.
Change-Id: I30d5339bc262d54ba76e2860a3a3e9e5f002fdc3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
The following sniffs now pass and were enabled:
* Generic.ControlStructures.InlineControlStructure
* MediaWiki.PHPUnit.AssertCount.NotUsed
npm:
* svgo: 2.3.0 → 2.3.1
* https://npmjs.com/advisories/1754 (CVE-2021-33587)
Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to this change, if a configuration array is defined
in extension.json, array elements cannot be overridden by
setting values in the corresponding configuration variable,
as intended by the array_replace_recursive merge strategy.
This is because the order of the arrays in the
array_replace_recursive() function call need to be
reversed.
Bug: T283464
Change-Id: I55561232a994f745c5f3cd8394674b18c0529d13
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I believe this is "cheap enough" to be worth it. Without this,
the error message(s) one runs into when a "config" element in
extension.json doesn't have a "value" are very confusing. I
run into this when a "value" line accidentally got lost in a
merge conflict.
Change-Id: Id71a882932f6979742055fa58dea35ea65a7c16f
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Add a merge strategy which sets the whole value only if the global
has not previously been set. This can be used to allow LocalSettings.php
to remove elements from an array created by extension.json.
Bug: T142663
Change-Id: Id250f9c349ee4eafbc759452ca6ea2a918baeb11
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
In all these cases the property is unconditionally set in
the constructor. The extra initialisation is effectively
dead code and an extra source of errors and confusion.
Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
|
|/
|
|
| |
Change-Id: Icd58c93bb0cff5b0a4e7b7f02873a271bab8964f
|
|
|
|
|
| |
Bug: T277987
Change-Id: Ieceb01f7a61693a0f03cc331213cb8f93163b8e9
|
|
|
|
|
|
|
|
| |
In most cases this will alleviate the need to use the
ImmovableNamespaces hook.
Bug: T277520
Change-Id: If1e1063a597ebdb39343a356cc381a6ceafaebcc
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ExtensionRegistry::getQueue() is currently documented as returning an
(associative) array of integers, which caused some confusion when
I3bee5d01399dcc965ec33a0d573ead144f1144a7 was being CR'd. As a follow-up, let's
clarify the return type documentation here.
Change-Id: Ifdebc3054e0434b509abdc26261b7c2207e2e075
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ExtensionRegistry caches components of load queues in APCu, varying the cache
keys on its own internal version, the MediaWiki version, the set of extensions
to be loaded etc. - in short, everything that may affect their contents.
However, it then uses makeKey() to build the keys, which scopes the keys to the
local wiki, making it impossible to reuse cached queues between wikis when the
parameters match.
On installs with a large number of wikis, this causes ExtensionRegistry to fill
APCu almost immediately after startup, resulting in a constant expunge cycle. At
Fandom, we implemented a patch[1] to allow reusing cached load queues between
different wikis by scoping the cache keys the global keyspace, instead of
generating wiki-local keys. This dramatically reduced the amount of ER cache
misses we observed, going from ~10% of total request time as reported by ArcLamp
to <0.5%.
[1] https://github.com/Wikia/mediawiki/pull/14
Bug: T274648
Change-Id: I3bee5d01399dcc965ec33a0d573ead144f1144a7
|
|/
|
|
|
|
|
|
|
|
|
|
| |
This was added for the stalled ConfigRepository project and never used.
It's currently bloating the cache that's read on every request early
during initialization.
When we do revive that project, we should make sure that the implementation
doesn't double cache the settings.
Bug: T274445
Change-Id: I16f31ecf1bc60dba9f93525d5dcb94129d9d149a
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This includes fixing some mistakes, as well as removing
redundant text that doesn't add new information, either because
it literally repeats what the code already says, or is actually
duplicated.
Change-Id: I3a8dd8ce57192deda8916cc444c87d7ab1a36515
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It was done in a funny way to allow extensions to provide paths that
are relative to a different base path than the core ones. This way
results in wrong paths on Windows. Use the ResourceLoaderFilePath
class instead, which I wrote for this exact purpose :D
With this approach, it should also be possible to handle remote paths
correctly, and remove the `'debugRaw' => false` hack in ServiceWiring,
but I don't entirely understand how that is handled in the extension
registration code.
Bug: T264965
Change-Id: Id501a10d87a60f8c71df49820e1fb866adc12411
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.
Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.
Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
|
|
|
|
| |
Change-Id: Ibc187d95b003017255bc87adf56afae7a59bd3db
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
Since this is a fairly hot code path, I'm hoping this will
help regain a bit of the performance we lost in T187154.
Change-Id: Ib2a8de9c3968cf5c924ce4335b7d445ac7bb3ed0
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the SkinLessImportPaths attribute for skin-specific LESS import
paths, which skins can use to override the mediawiki.skin.variables.less
file.
As a starting point, add the following 5 variables:
* device widths (3x)
To help phase out 'mediawiki.ui/variables'. These are
commonly used by MobileFrontend.
* @font-family-sans
Recommended by Volker. Used by multiple skins.
* @border-radius-base
Recommended by Volker as example of something that we currently
hardcode in MediaWiki core for Vector and OOUI/WikimediaUI
in 'mediawiki.widgets.datetime' but should instead be allowed
to vary by skin and OOUI theme.
Remove the hardcoded value for '@border-radius-base' in
various places in favour of importing from mediawiki.skin.
The default is a bare default of 0 (as border-radius is off
by default in the browser).
The value for Vector is restored there by I47da304667811.
The value for MonoBook is improved by I000f319ab31b.
Bug: T112747
Change-Id: Icf86c930a3b5524254bb549624737d3b9dccb032
|
|
|
|
|
|
|
|
| |
Exceptions classes are nearly always value objects, and should in most
cases by newable.
Bug: T247862
Change-Id: I4faa8ec6ea8bc44086cfc8075b32d10eea61e9df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Deprecating something means to say something nasty about it, or to draw
its character into question. For example, "this function is lazy and good
for nothing". Deprecatory remarks by a developer are generally taken as a
warning that violence will soon be done against the function in question.
Other developers are thus warned to avoid associating with the deprecated
function.
However, since wfDeprecated() was introduced, it has become obvious that
the targets of deprecation are not limited to functions. Developers can
deprecate literally anything: a parameter, a return value, a file
format, Mondays, the concept of being, etc. wfDeprecated() requires
every deprecatory statement to begin with "use of", leading to some
awkward sentences. For example, one might say: "Use of your mouth to
cough without it being covered by your arm is deprecated since 2020."
So, introduce wfDeprecatedMsg(), which allows deprecation messages to be
specified in plain text, with the caller description being optionally
appended. Migrate incorrect or gramatically awkward uses of wfDeprecated()
to wfDeprecatedMsg().
Change-Id: Ib3dd2fe37677d98425d0f3692db5c9e988943ae8
|
|
|
|
|
|
|
|
|
|
|
| |
This avoids the need for extension.json to state the name of the
extension in two different places (which could then disagree).
Parsoid needs the name of the extension which registers a given
module for error reporting.
Bug: T133320
Change-Id: I0abb7ab433e4ac9c94cf2f9720b174372a29dc10
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
See also I20f641a1ff032a6da3549b01dfaf8f4cf1eb5071, which uses this
attribute, and the earlier discussion in the (abandoned)
Ia251d631febf5be7fcad21cd8b73a68ec2785137.
Bug: T133320
Change-Id: I6c74938883376ec17f3790678b435585083a440f
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This data is the same as the 'credits' data that is already compiled,
cached and made available via ExtensionRegistry.
Similar to various other configuration variables previously, the
$wgExtensionCredits variable is now also required to only be used
for providing input to the system (e.g. from LocalSettings.php,
or from legacy extension PHP entry points). It is no longer
supported to use this variable to reliably read out a full view
of all extension credits (specifically those registered via
extension.json).
Doing so had the downside of adding processing cost to every
web request, as well as taking one the single largest portion
of the ExtensionRegistry APCu cache key, which in PHP7+ incurs
a linear cost for every string value, string key, of every
(sub)array in this huge structure; and does to on every request
just in case something reads from $wgExtensionCredits.
The new method to access this information reliably is owned
by SpecialVersion for now (could be moved elsewhere). This
also makes the merging logic more testable and incurs it on-demand
rather than upfront.
Details:
* Move 'type' internally from NOT_ATTRIBS to CREDIT_ATTRIBS.
These two arrays behave identically for most purposes (they are
both used to mean "don't export this as a global attribute").
By placing it in CREDIT_ATTRIBS it becomes complete and makes
it easy to refer to in docs. Previously, extractCredits()
read the 'type' key outside the loop for CREDIT_ATTRIBS.
* Remove redundant code in ApiBase.php, that is now more obviously
redundant. Looks like a left-over or merge conflict mistake
from when ExtensionRegistry was first introduced.
Bug: T187154
Change-Id: I6d66c58fbe57c530f9a43cae504b0d6aa4ffcd0d
|