| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
In MediaWiki/Exception, to follow PSR-4 per plural vs. singular (this can be
changed later if people really care). Also, move the couple of exceptions in
here that were already namespaced in the MW-top-level into the new space.
Bug: T353458
Change-Id: I12ed850ae99effb699a6d7ada173f54e72f0570e
|
|
|
|
| |
Change-Id: I29bc609c5148668e533a9ed9f72b29f780f00dba
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.
Also remove uses of get_class() and get_resource_type() where the new
method already provides the same information.
For reference:
https://www.php.net/manual/en/function.get-debug-type.php
https://www.php.net/manual/en/function.gettype.php
To keep this safe and simple to review, I'm only changing cases where
the type is immediately used in an exception message.
Change-Id: I325efcddcb58be63b1592b9c20ac0845393c15e2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mostly used find-and-replace:
Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4
More could be done, but to keep this patch reasonably sized, I only
changed the most obvious and unambiguously correct cases.
In some cases, I also removed redundant doc comments on the
constructor, and re-ordered the properties to match the constructor.
Change-Id: Ibcb81c7ecdbc24820c76d159d50e2f79c7c4c656
|
|
|
|
| |
Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
|
|
|
|
|
|
|
|
|
| |
In PHP `true && 1` evals to `true`.
In JavaScript `true && 1` evals to `1`.
The convert to a boolean by !!() in JavaScript is not needed anymore.
Change-Id: Ie2ff2ef3aa9c5ada82fb2820992d17128fa2fbff
|
|
|
|
|
|
|
| |
One of the big ones, so doing this alone.
Bug: T166010
Change-Id: Ibe103cd362535d3cb94cb8931e95fc74099d1497
|
|
|
|
|
|
|
| |
One of the big ones, so doing this alone.
Bug: T166010
Change-Id: I4c901d5c32696d8334ec30cede7d9b6f3d8d645e
|
|
|
|
|
|
|
|
|
|
| |
The service was previously accessing the global ExtensionRegistry
singleton, making it lose its statelessness. Dependencies should always
be injected, so add constructor parameters for that.
Simplify tests accordingly.
Change-Id: Iae375a81cab411fab607cba0addb2088131b3c81
|
|
|
|
|
|
|
|
| |
When the value of the associated array is not used, there is no need to
use array_keys and create internal a copy of the array, just omit the
value with $_ to tell static analyzer that the var is unused.
Change-Id: I5c6d667e98c0167c0573c683f0d617bc1d4ca619
|
|
|
|
|
|
|
| |
The main goal is to make this code faster and easier to read, and to
avoid duplication.
Change-Id: I925d742d560e9d90e3ecc9ff19fe7e87b60bf9a4
|
|
|
|
|
|
| |
It has been deprecated since 1.34 and it is unused.
Change-Id: Icd9b33a8c4051505e16aad384ebb509aa5e18649
|
|
|
|
|
|
| |
Doc-only changes
Change-Id: I5177f582ae7ee70c357e9389fed14819faf79463
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This edition brought to you by:
grep -ERIn $(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | tr
"\n" '|' | sed 's/|$/\n/') includes/
I only corrected a fraction of the results provided by that command. I'm
submitting the partial patch now so it doesn't bitrot.
Bug: T305805
Change-Id: If1918c0b3d88cdf90403921e4310740e206d6962
|
|
|
|
|
|
|
|
|
| |
We can generate a class that contains constants for all config variable
names. This removes the need to rely on string literals when calling
Config::get, and it provides a place for documentation that integrates
better with IDEs than the markdown file.
Change-Id: I817dc14c4ce8fc0a29d9c07e8fd393c4f359cade
|
|
|
|
|
|
|
|
|
|
|
| |
This patch focusses on permission related stuff.
"Policies" is particularly confusing in this patch. In some cases the
word refers to a list of policies (one such policy being e.g. "minimum
password length = 8 characters"). But sometimes it's a list of lists
of such policies, keyed by user group.
Change-Id: I0346e59c7b79839114dd0d0bc7ee38289c1b06a1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
In most cases this will alleviate the need to use the
ImmovableNamespaces hook.
Bug: T277520
Change-Id: If1e1063a597ebdb39343a356cc381a6ceafaebcc
|
|
|
|
|
|
|
| |
Clarify that this method does not refer to SpecialPage subpage
parameters.
Change-Id: Ief54be2e83d4b09b265754849db487923d872939
|
|
|
|
|
|
| |
It's overdue and appears unused
Change-Id: I5d7f4a52b3258b2e711792ac0f5487f0b44c92a6
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: Ibc187d95b003017255bc87adf56afae7a59bd3db
|
|
|
|
|
| |
Bug: T245293
Change-Id: I4026eda0d072426112040c5c74cc6e14382b7681
|
|
|
|
|
|
|
|
| |
These were never meant to be part of the public interface and should not
ever have been marked with @since. They're only useful for constructing
the respective objects, which no outside users should be doing.
Change-Id: I86e01272d46fc72af32172d8a12b9180971d4613
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Bug: T253098
Change-Id: Ifa5a3d587fe8298d356f513bcbf2a432cc70712b
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Trigger deprecation warnings in NamespaceInfo::isMovable, where it is
used
Bug: T245293
Change-Id: Iec8b60ae97e390e7aa88ae2e8fbeb234e728d9d9
|
|/
|
|
|
|
|
|
|
| |
Mostly just for debugging purposes; later we can enforce this with a type hint,
but first I want to track down the uses.
Bug: T253098
Depends-On: Ieecbc91a8f26076775149a96fbe1b19a7f39dcef
Change-Id: I66ea07f1acf6db2d13de488b775361f45b69020c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
|
|
|
|
| |
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
|
|
|
|
| |
Change-Id: I676a68fdc42ff2f37c7e4a2700b7c0c448155d47
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
The main namespace is missing from the list of canonical names.
Bug: T232004
Change-Id: I2ec9af3ba657d87d3a0eb7febafb3ca4eb7c59ac
|
|/
|
|
|
|
|
|
| |
This allows us to remove many suppressions for phan false positives.
Bug: T231636
Depends-On: I82a279e1f7b0fdefd3bb712e46c7d0665429d065
Change-Id: I5c251e9584a1ae9fb1577afcafb5001e0dcd41c7
|
|
|
|
|
| |
Bug: T11977
Change-Id: I051be9148c98086fdf53a66a74bf7c28699016db
|
|
|
|
|
|
|
|
| |
It is sometimes necessary to get an unmodified list of namespaces that are in
core.
Bug: T226657
Change-Id: I8e4ed19db915a1673c27ca5b212d712d079b4bba
|
|
|
|
|
|
|
|
|
|
| |
This causes Title::getTalkPage and NamespaceInfo::getTitle() to throw
an MWException when called on a LinkTarget that is an interwiki link
or a relative section link. These methods were already throwing
MWException when called on a link to a Special page.
Bug: T224814
Change-Id: I525c186a5b8b8fc22bca195da48afead3bfbd402
|
|
|
|
|
|
|
|
|
|
| |
When $wgNamespaceProtection specifies multiple rights for a
namespace, the code was assuming all of those rights had to
come from one group. But MediaWiki allows for the rights to
come from multiple groups that each give a subset of the rights. Allow for that case.
Bug: T222598
Change-Id: I1e9aca6e521260f783bd881e7d095d62bc605dc6
|
|
|
|
|
|
| |
This allows converting some more code to LinkTarget. 100% test coverage.
Change-Id: I28903af6a41d02755f37f31561a524547445821e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the new tests I added, I tried to cover all interesting scenarios and
not just hit each line to make the coverage green. But I didn't review
all the existing tests to see if they were properly thorough, so there
might still be room for improvement.
I uncovered a bug here that will be addressed in a separate commit,
because the fix is not so simple. For now I left the test expectation as
a @todo.
Change-Id: I33d556bf83c631a8a02a6c77f2f5cb06b8dbf869
|
|
|
|
| |
Change-Id: Ie43e6108c6b9bcb666b1dece055e0df689e2ec42
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Originally I had intended setMwGlobals() to magically reset the
namespace-related services if namespace-related settings were changed,
but Tim told me to remove it during review and I forgot to update the
release notes. Moving forward, everyone will need to reset services
after every config change to ensure correctness, and there's no point in
trying to reset specific services automatically as special cases.
I also moved the note to the 1.34 notes, since this missed the cutoff
and should not be backported.
Change-Id: Ib7cbdaef22a15ddfc7aaf99d0972b99d3cddc011
|
|
MWNamespace::clearCaches() has been removed entirely, along with the
$rebuild parameter to MWNamespace::getCanonicalNamespaces(). The rest of
MWNamespace is deprecated.
Diff best viewed with -C1 so git notices that NamespaceInfo is a copy of
MWNamespace.
Depends-On: Icb7a4a2a5d19fb1f2453b4b57a5271196b0e316d
Depends-On: Ib3c914fc99394e4876ac9fe27317a1eafa2ff69e
Change-Id: I1a03d4e146f5414ae73c7d1a5807c873323e8abc
|