This method was recently added and was to result in the deprecation
of a few places where User objects were being passed to the factory.
This has now been reconsidered and this patch reverts to the
previous behaviour. It is largely a revert of Ie1bed9e9537cabc836992ccfa7fb127885ea3e11
Bug: T238466
Depends-On: Idc9f33fd5ab55bde88cc306ca63adead286380a8
Change-Id: I3653559704ccfd9bca0946f5a865be93bdf5ceb6
This allows us to distinguish between "Foo" and "User:Foo" in the UI.
Follows-Up: Ia0ddf78646ec4c8ae0b84b6d5b46ef5e51c8e8c1
Change-Id: I960cbd566e444380a253bde364bc9da7e2975823
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
Add a new setUser() method to PreferencesFactory so that a User
object doesn't have to be passed around so much. This is how
GlobalPreferencesFactory has done it, and so after this change
that code can be removed from GlobalPreferences.
Bug: T238466
Change-Id: Ie1bed9e9537cabc836992ccfa7fb127885ea3e11
Add a new preference filter for use with HTMLTitlesMultiSelectField, to simplify
the process of saving article text as IDs in user preferences, and reading those
IDs back to text for presentation in the form.
Example usage in the Echo extension: I67f751eae5fdc5bccff7fe3047227d432c1cb8d5
Change-Id: Ia0ddf78646ec4c8ae0b84b6d5b46ef5e51c8e8c1
The modern style is to use forward slash comments, and the
dividers date from before this class was refactored to separate
these sections by method. Some @todos are also reformatted.
Change-Id: Ib642e83802cc78025ab22614a8e5fa9472d4bf59
Add hook interfaces which were generated by a script which parses
hooks.txt and identifies caller namespaces and directories.
Hook interfaces are mostly placed in a Hook/ subdirectory
relative to the caller location. When there are callers in multiple
directories, a "primary" caller was manually selected. The exceptions to
this are:
* The source root, maintenance and tests, which use includes/Hook. Test
hooks need to be autoloadable in a non-test request so that
implementing test interfaces in a generic handler will not fail.
* resources uses includes/resourceloader/Hook
* The following third-level subdirectories had their hooks placed in
the parent ../Hook:
* includes/filerepo/file
* includes/search/searchwidgets
* includes/specials/forms
* includes/specials/helpers
* includes/specials/pagers
Parameters marked as legacy references in hooks.txt are passed
by value in the interfaces.
Bug: T240307
Change-Id: I6efe2e7dd1f0c6a3d0f4d100a4c34e41f8428720
This isn't a default setting or fallback, it's unconditional
business logic that can't be overidden. This doesn't need to
run on every web request in Setup.php.
Bug: T189966
Change-Id: I708131b111cd2ff0e34c3cc8a4b933eff260b3da
The extensive label for the "how" of the form in English obscures the "what". By
splitting the radio button's label into a short "what" and retaining the current
message, which in English is currently *entirely* a "how", allows translators to
retain the opportunity to advise their users about the manner in which this will
affect their experience.
Change-Id: I5ca2fb56ee4b50bd6af9b13dfe3c50c1f661a4e8
1. into class Parser
2. into class LinkHoderArray
3. into class DefaultPreferencesFactory
Add more tests for DefaultPreferencesFactory:
1. testVariantsSupport verifies that converter with variants is used correctly.
2. Test testUserGroupMemberships verifies that membership is used correctly
Bug: T243320, T243321, T243317
Change-Id: I1e5c37e18332d0d32391c74c06e3d84862e48df8
Done:
* Replace LanguageConverter::newConverter by LanguageConverterFactory::getLanguageConverter
* Remove LanguageConverter::newConverter from all subclasses
* Add LanguageConverterFactory integration tests which covers all languages by their code.
* Caching of LanguageConverters in factory
* Make all tests running (hope that's would be enough)
* Uncomment the deprecated functions.
* Rename FakeConverter to TrivialLanguageConverter
* Create ILanguageConverter to have shared ancestor
* Make the LanguageConverter class abstract.
* Create table with mapping between lang code and converter instead of using name convention
* ILanguageConverter @internal
* Clean up code
Change-Id: I0e4d77de0f44e18c19956a1ffd69d30e63cf51bf
Bug: T226833, T243332
This prevents the double escaping and similar label messages
such as `prefs-registration` on the same page are already not parsed,
some could have been doubly escaped if they were too.
Bug: T142882
Change-Id: Icec32660a19543f4a97c8acc594b1c09e09f9aa1
Move the Password Reset Update (PRU) setting in user profile preferences
right before the `Email confirmation:` label.
Bug: T239938
Change-Id: Ib8bfd23e7bf94d3113846436d162cd3a059f115c
Add informational text under the 'Basic information' section regarding
email user preference setting under 'Email option' section for users with
an associated email address.
Bug: T234952
Bug: T239937
Change-Id: I1a815db0e54673a69afb74506d97c1f6460cb7d1
Scalar casts are still allowed (for now), because there's a huge amount
of false positives. Ditto for invalid array offsets.
Thoughts about the rest: luckily, many false positives with array offsets
have gone. Moreover, since *Internal issues are suppressed in the base
config, we can remove inline suppressions.
Unfortunately, there are a couple of new issues about array additions
with only false positives, because apparently they don't take
branches into account.
Change-Id: I5a3913c6e762f77bfdae55051a395fae95d1f841
The <span class="error"> is not needed, the text is already formatted
as an error message by OOUIHTMLForm. Maybe it was needed in plain
HTMLForm back in the day, or maybe this was just always wrong.
Change-Id: I54dd401c059af849a91437d7a89aaa387c301e08
To avoid preference bloat, this preference is hidden unless the new
sysadmin config $wgSearchMatchRedirectPreference is set.
Bug: T235263
Change-Id: Ic16f53a4e6ddb6da071d63cd5da28d937d4692c8
These are almost only doc changes, with two exceptions:
1-In LinkHolderArray, int-alike array keys are now cast to int, to be uniform with what we do in other code paths
2-In ExtensionRegistration, changed a line to throw an Exception
immediately, instead of an ExtensionDependencyError. This is because the
latter takes an array with msg and type, but we were passing it a plain
string (and in fact the code was bugged).
Bug: T231636
Change-Id: I8b0ef50d279c2a87490dde6a467a4e22c0710afd
This was temporarily removed in 3bcf5655870f for compat with
the GlobalPreferences extension. The old typehint of HTMLForm
was incorrect (as discovered by a Phan rule that was disabled
for core), because getModifiedUser() only exists in the
PreferencesFormOOUI subclass.
Change-Id: I792286ed44f03467b5d875e61c52b1953252b55f
Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0
It's not just about the preference name, because current user's properties
are used for validation too.
Bug: T231029
Change-Id: I268b959017bb0dce2b4295d5302a544bfa3513eb
Fixes a bug introduced in b2b204eeaf.
$useSkin is not the appropriate variable to check here - we want
to check the skin set in preferences.
Bug: T223824
Change-Id: I666e30dd9ff396fd39c47b362d66670dfaa92ca9
This seems to be still used internally in core but in no extension. Also,
this function really doesn't do anything so hard deprecating in preparation
for removal.
Bug: T62260
Change-Id: I568789483084a97e5b3b462235f3d00c3cb87cf9
It should be possible for power users to reveal hidden preferences
using the useskin query parameter. In future this will allow us
to use wgSkipSkins to deprecate poorly supported skins for new
users whilst not hard deprecating and removing skin support for
users who strongly want to continue to use them.
Change-Id: I1bbd4a09dff72f513c9413e0f826d8db38a5e04c