This name is consist with the rest of the setter and getter methods
in ParserOutput. Renamed the methods in OutputPage, ImageHistoryList,
ImageHistoryPseudoPager, and ContribsPager as well for consistency;
it also makes chasing down lingering references in codesearch easier.
Soft-deprecated the old name for 1.38. Hard-deprecation will follow,
but there are a number of users in production that should be chased
down first.
Code search:
https://codesearch.https://codesearch.wmcloud.org/deployed/?q=(allow%7Cprevent)Clickjacking&i=nope&files=&excludeFiles=&repos=
Bug: T287216
Change-Id: I9822c60c180d204bd30cb4447a1120155d456da4
The message keys by 'options-messages' are evaluated with
Message::plain(), but some situation needs Message::parse() to support
templates and HTML formatting in this values.
Bug: T58633
Change-Id: I8f52f21ae2641ddcad1aa85ce6bf14de1a09ab4b
Note that this changes the effective type of the protected mCancelTarget
field. This fields has no declared type, and does not seem to be used in
any subclass. The type of mTitle is not changed at this time, but
nothing seems to rely on that either.
Bug: T278459
Change-Id: I4bf0d46c74b53ffc9cb3e6e497c789ef6b3bab6a
Implements HTMLTagMultiselectField, a form field that instantiates
TagMultiselectWidget, the PHP representation of the OOUI's js-based
widget of the same name with the implemented parameters:
* allowArbitrary
* allowedValues
Bug: T278317
Change-Id: I3a6a30506d493be4185f917c577b3837fffd8ae1
single string is raw html,
not a message key as documented on HTMLForm::trySubmit
Also remove is_string, any truthy value would be implicit string casted
in HtmlForm::getErrorsOrWarnings
Reorder the if in HtmlForm to look similar to OOUI
Change-Id: I5b78b0df2cca695f8f5c6b08aa4d6c015d1fa1fe
Deconstructing non-sparse, numerically indexed arrays directly in
foreach (a.k.a. using the list() syntax in foreach) is possible since
PHP 5.5.
The possibility to use string array keys as well as non-sequential
numeric keys in array deconstruction was added in PHP 7.1.
Change-Id: I56a48552a45f61cedc291b306cad8548fc70d485
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
The code that enables collapsible elements in 'mediawiki.page.ready'
may not run on special pages.
Bug: T260642
Change-Id: I4c5250f5b2575ec6699b99bf979c02e5ac16722d
Not working on Special:AbuseFilter for example
Skins can disable this module so special pages must
add it explicitly.
Bug: T260642
Change-Id: I51deedf9c60279b0917ab085fd7498edf55e93da
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
The status object, which can be returned after validating an HTMLForm,
can contain message objects. These message objects can be constructed
with the full feature set provided by Message, e.g. raw parameters.
The handling of these status objects in HTMLForm basically prevented
some features of the Message object in the status, as it parsed the
messages through the Parser, which does not recognize these raw
parameters as such and escapes them wrongly.
This behaviour is fixed with this change.
Bug: T240774
Change-Id: I152ec51f317799572bf6791e110cd72c42da82a0
This was a server-side check that made certain <button> elements
render as <input> for IE6 and IE7. MediaWiki no longer offers
basic support for these browsers per RFC T232563.
Change-Id: Ibd27b6fda3929bf94a5362a0369b3744e42de121
"Other methods call done after that" should be "Other method calls
done after that" (though "Other methods called after that" would
work too.
Change-Id: I9fe8194647c134e6d2aea7b88c3fd4140ffb9883
Most of the original scope of this patch was implemented in 8665536045
What remains is to use the splat operator in the method signature as
well which is more readable than using func_get_args and doesn't annoy
phan. This is now possible, because we are no longer testing on HHVM and
these mocking in HHVM tests was the only place where this was broken.
Change-Id: I52912d1810b955b05cd17fab424f80c201883411
The return type of HTMLFormField::loadDataFromRequest to mixed
Some sub classes returning arrays or bools, not everytime strings
HTMLCheckField is working with arrays, so also allow array on getTableRow
Change-Id: I076feea76d8e296f27c8a9fb4cbd9368584ba187
Once you instantiate an HTMLForm there was no clear way of adding
new fields except for hidden fields. This is particularly problematic
when the form is passed by reference in Hooks.
NOTE: this is just moving what was previously part of the constructor
into its own method + very small tweaks
Change-Id: I23f983417510841ce76cdefcb076e5ab97b43f10
Follows-up 36d33daa03.
Previously the method was described as "Set whether the form can be collapsed"
taking a single boolean.
Yet, the boolean did not influence whether the form can be collapsed, as one
might expect.
Rather, this method always enable collapsible mode. The thing that is set
based on the passed value is the default state of that (unconditionally)
enabled collapsible mode.
Change-Id: I2e73d5481c44ed43769553b2bc25543a702c19b8
In 3706dcb, this method was soft deprecated and hard deprecated at
the same time (1.28) but during the call to wfDeprecated for hard
deprecation, the version number was missed, though this will default
to false, it's good to use the version number which is known in this
case (1.28).
Change-Id: I535ad07e79d14bac8ec42beaeb4b3762a494b28b
Also minor tweaks:
* Fix @since tags, this did not make it into 1.33
* Fix usage of FieldsetLayout 'group' in OOUIHTMLForm
* Documentation changes
Follow-up to 2896e87a10,
per my post-merge review on that commit.
Change-Id: Ib93375cde19730a46e4929878d6e472d3ac8f631
The method has not actually supported scalar or single-level array
arguments for a while now; according to Michael Große, this ability was
lost in Ibb17bb61ac. No one seems to have noticed (indeed, MediaWiki
code search finds no callers at all [1]), so instead of trying to fix
it, let’s just update the documentation.
We can also remove a cast to array in trySubmit(), because if the value
wasn’t already an array, then converting it to a single-element array
and then trying to spread its only element into $hoistedErrors->fatal()
arguments still fails (“only arrays and Traversables can be unpacked”).
[1]: https://codesearch.wmflabs.org/search/?q=setValidationErrorMessage
Change-Id: I8c292ec62ef4aec89217e86a75d7f2e88111f43f