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: I1f306a3925d6768209a06e70082598b2f70cd319
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
Why:
* In 19238b429f, the
ContributionsSpecialPage class was modified to not perform
queries if the submitted form data was not determined to
be valid.
* This was necessary to allow IPContributions in CheckUser to
not run the query if the form was invalid.
* However, this broke looking up contributions from IPs that have
the UseMod wiki format (i.e. "xxx" instead of the last octet of
an IPv4 address) because the HTMLUserTextField class does not
consider these as valid IP addresses.
* Fixing this is necessary to allow looking up contributions from
these IPs in the contribution pagers.
What:
* Update HTMLUserTextField to have a 'usemodwiki-ipallowed' option
that when specified as true will allow IP addresses in with the
UseMod wiki format.
** This is done via the regex used by UserDef::processUser which
determines if an IP is a UseMod wiki IP
** This option is only used if the 'ipallowed' option is also set
to true.
* Update ContributionsSpecialPage::getTargetField to specify that
the 'target' field should allow UseMod wiki IP addresses.
* Add tests for the changes to HTMLUserTextField and also a
regression test via SpecialContributionsTest.
Bug: T370413
Change-Id: I2b1d981a21c7b85c22a371708776c7ca127dec4c
Ensure CodexHTMLForm reflects HTML changes made to Codex components,
Radio and Checkbox.
- Changed the top level element from `span` to `div` in HTMLRadioField.
- Update test in HTMLRadioFieldTest.
HTMLCheckboxField already has a top-level `div` so no changes are
needed.
Bug: T370689
Change-Id: I0b7e5369e23b1a95e431014d7b22f3f1064b3dba
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Ia35b2d3105880631dd26ec974068b000ac7f4b6b
HTMLMultiSelectField used the jquery.chosen library, but only for the
legacy display format, and only if the 'dropdown' option was passed.
There is only one form that passes the 'dropdown' option
(SpecialActiveUsers), and that form uses the OOUI display format, so
this code is unused.
Also remove the htmlform-chosen-placeholder i18n message, which is now
unused as well.
Bug: T53443
Change-Id: Ie4f9fff322ae26fbdf9eae1b3634d1b04e746179
It was asked in a patch review to apply fully import
InvalidArgumentException where possible. I was guessing some
of my other already merged patches have but turned out such
thing exists other places style so for the sake of consistency
I've turned rest of inline import of the specific exception at
top of the file.
There are instances of source files that aren't in any namespace but
have fully qualified import which this patch doesn't touch.
Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
This patch introduces a namespace declaration for the
MediaWiki\Json to FormatJson and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
This patch introduces a new namespace declaration,
MediaWiki\Xml and adds Xml and XmlSelect to it
and establishes class aliases marked as deprecated
since version 1.43.
Bug: T353458
Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
Fix the real issues found by this sniff, and convert the remaining
false positive ignores to per-line ignores so that any more real issues
won't be added.
Change-Id: I18e75d59df327e2d93a3a487c115e92b9f268722
Create a static method that returns the HTML for a Codex button.
CodexHTMLForm::getButtons() and HTMLButtonField::getInputCodex()
calls the static method and passes in a list of attributes,
flags, and the button label needed to build the Codex button.
This patch changes the way the Codex submit button is created. In a
previous patch, the submit button was an instance of HTMLSubmitField.
Bug: T361406
Change-Id: I046de61d4808f034335254e9a9c853f133d66a9b
- Put select or fields side-by-side and apply form guidelines margin
- Put select and fields underneath with correct margins
- Indent connected components to Radio above visually
Change-Id: I7d262f533122cff5cf6e7be26af40090232c359e
Was only there for IE 6 & 7, which are gladly not supported in our
infrastructure and codebase for some years now.
Bug: T234582
Change-Id: I111ec7c45f04caf82a796b701baf206ebbc0540b
`$this->mOptionsLabelsNotFromMessage` is set when calling
`$this->getOptions()`, meaning the previous code wasn't actually seeing
its expected value. Compare with the `getInputOOUI` implementation,
where the ternary is inside the foreach loop.
So, do the same thing for Codex and choose the function to use inside
the loop. Also use the full method name in both cases instead of
indirect calls, as it makes the code easier to analyze statically (also,
the call itself is pretty simple).
Follow-up to I73b2e95cff.
Change-Id: Ie6b626fa4f9822f76bf202c5ed66ec16c17dc422
HTMLInfoField overrides getDiv(), getTableRow() and getOOUI() to output
the raw value if 'rawrow' is set. Override getCodex() too, so that
'rawrow' also works correctly in CodexHTMLForm.
This caused a bug where going to
Special:UserLogin?warning=mobile-frontend-watchlist-purpose would show a
message box that was incorrectly wrapped in a cdx-field div. That seems
to have been harmless, but it's incorrect behavior and could cause
styling bugs in the future.
Change-Id: I1fd4e2e53f9e03561fe300b6924e44cf222db3c9
Adds support for all Codex Buttons by removing the
hard-coded values in the flag class array ($flags).
This patch adds the `cdx-button` class to class
attributes. It maps each flag in `$this->mFlags`
array to the corresponding CSS class name and
appends each flag class to the flag class array.
This ensures that all flag classes defined in
$flags are included in the HTML output.
Flags include 'progressive', 'destructive', 'primary',
and 'quiet'.
Flag classes include:
- cdx-button--action-progressive
- cdx-button--action-destructive
- cdx-button--weight-primary
- cdx-button--weight-quiet
Bug: T359018
Change-Id: I4ceaa3ef484f654bd908479d27ce0d32ed099d86
HTMLHiddenField does some black magic by outputting nothing and then
adding a hidden field to the form somewhere else. This black magic
wasn't updated for CodexHTMLForm, so it broke on forms that use Codex
(specifically, the login form, where CAPTCHAs are added using
HTMLHiddenField).
Bug: T360717
Change-Id: I2faec05d809b926b2ec2dedaceb7c74a445e06b2
Add the 'option-descriptions', option-descriptions-messages' and
'option-descriptions-messages-parse' settings to HTMLRadioField, which
allow setting descriptions for each option.
For simplicity, only support this for HTMLRadioField, and only for
Codex. See also T324268 for a previous stalled attempt to implement this
for OOUI, which ran into issues.
Bug: T359019
Change-Id: I38116bb2fa3086408d3e2b47e5fe020b30f9729a
Adds a CSS-only version of Codex Radio via HTMLRadioField.
Iterates through the list of options obtained from `getOptions()`
and generates the HTML markup for each radio input, radio icon,
and radio label. The three elements (input, icon, label)
combined make a single Codex Radio. The Radios are appended to
an empty `$html` string variable. The function returns the
concatenated HTML markup.
Bug: T359015
Change-Id: I73b2e95cff0bc50ba1bc70457d65e286592288ac
The Codex implementation of HTMLNamespacesMultiselectField and
HTMLTitlesMultiselectField falls back to a simple `<textarea>`, which is
also what the OOUI implementation does if JS is not available. However,
OOUI sets rows=10, which results in a much more reasonably sized
textarea then HTMLTextAreaField's default of rows=25.
Pass rows=10 to HTMLTextAreaField, but allow the field params to
override this.
Change-Id: I1e9a1ab6b4a71fb247bfe7861a49bb6cfeb61f54
Add support for generating a Codex TextArea via
HTMLTextAreaField, then add Codex handlers to
HTMLNamespacesMultiselectField and HTMLTitlesMultiselectField,
which fall back to a TextArea.
Bug: T359015
Change-Id: I659241f56fae8aa60e25ad0c65b62e8465edad99
This patch enables use of a Codex component for the following
HTMLFormFields:
- HTMLExpiryField
- HTMLSelectAndOtherField
- HTMLSelectField
- HTMLSelectOrOtherField
It also adds a new public static method to HTMLTextField that
takes in attributes and returns the HTML for a Codex text input.
Note that the Codex CSS-only Select does not yet support an
error state, so this has not been implemented here.
Bug: T359015
Change-Id: I6857813b9dbe09ae68d6cafdc87351d01626266a
- Refactor the HTMLButtonField, HTMLCheckField, and HTMLTextField
classes to include getInputCodex() methods, rather than checking
if CodexHTMLForm is being used.
- Add error classes if applicable.
- For HTMLCheckField, ensure that tooltips are propagated to the
wrapper div instead of the label, so a tooltip will display no
matter which part of the component you're hovering over
(including the space between the input and label text).
Bug: T359013
Change-Id: I0ead69e2b6b33f48949a2dfe40140f2ef957bc06
It's a dropdown, not a drop down, therefore rename:
* Html::listDropDownOptions → Html::listDropdownOptions
* Xml::listDropDownOptions → Xml::listDropdownOptions
* Html::listDropDownOptionsOoui → Html::listDropdownOptionsOoui
* Xml::listDropDownOptionsOoui → Xml::listDropdownOptionsOoui
* Xml::listDropDown → Xml::listDropdown
In PHP, method names are case-insensitive, therefore we can do this
without a breaking change or deprecation.
This also matches the naming convention in OOUI.
Change-Id: Ifda13ba9dee316709c424636ec3b285de8d0e9b1
* Switch out raw Exceptions, mostly for InvalidArgumentExceptions.
* Fake exceptions triggered to give Monolog a backtrace are for
some reason "traditionally" RuntimeExceptions, instead, so we
continue to use that pattern in remaining locations.
* Just entirely give up on PostgresResultWrapper's resource vs. object mess.
* Drop now-unneeded false positive hits.
Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
Removing the config variable in a separate change:
Ib9966bc6a4a94f771cb99a5aa52fb6a1dc826ca5
(just in case something depends on its existence).
Bug: T182050
Change-Id: Ic3e038df16fc540ec7f6bcb9a54d73f8d596d305
The main benefit is that IDEs, static analyzers and such are now
able to understand that this refers to code from the
HTMLFormFieldCloner class. This was completely hidden before.
Also fix a mistake in the documentation for getNearestField. This
was accidentally copying the getNearestFieldValue documentation,
which does return mixed.
Change-Id: Ie4204bc967013825d9d73d30f264b07ff0c9e846
Or just remove it. It's not needed when the structure is already an
array. PHP will happily initialize multi-dimentional arrays when
needed.
Change-Id: I93845e8d6f870d147bd55cfe3827bc94b375d0ba
Helps bot operators adhere to the principle of least privileges.
Grants can now be restricted to allow editing (and other write
operations) for upto 25 listed pages. The page IDs are persisted within
the bp_restrictions field of bot_passwords table, and in the session
metadata.
This restriction is checked only as part of expensive checks in
PermissionManager, since they are not applicable for UI actions.
Bug: T349957
Change-Id: I3d228eb97664d040a160c5b742d9176fdfae9a43
Earlier, loadDataFromRequest() returned MWRestrictions object only in
case of valid input, and the original string if invalid. Now, an
MWRestrictions object is returned in all cases, on which we now have a
validity field. This also de-duplicates the check to find the invalid IP
address(es).
Bug: T349957
Change-Id: Iadb762b572cf0e7d2b92dbc4912804a3ddb48e74
This is a composite field meant for a specific purpose, rather than a
fundamental component.
No sub-classes were found in Code Search.
Bug: T349957
Change-Id: Idfb526a341b95322b698a5992b72f5ee8aabf497
Using a flag depends on the *-mode query param, so won't care about
the default value of empty input being 0, empty string, or null anymore.
Bug: T347229
Change-Id: I389adfdf941a8cfd96a68b66120a209b5f38fbbe