Commit graph

82 commits

Author SHA1 Message Date
vladshapik 3f46a9b5c1 Avoid using User ::getCanonicalName
Remove using of User::getCanonicalName since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T275030
Change-Id: Ic11a4259271c8941225882ddce64b53d44280409
2021-02-21 23:44:07 +02:00
libraryupgrader b482798a02 build: Updating mediawiki/mediawiki-phan-config to 0.10.5
Change-Id: I6f9091dbff52c91c6ad81a386a2355a82ab6012a
2020-12-10 22:03:48 +00:00
libraryupgrader fd495575a1 build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
* MediaWiki.Commenting.PropertyDocumentation.WrongStyle

Change-Id: I8479cfb5fbc67a6472e28045ece5ea2ae1ba6ac6
2020-10-29 08:41:34 +00:00
Florian 9aba484800 Add Content Security Policy handling for ReCaptcha and hCaptcha
Bug: T250544
Change-Id: I280054a8252c991cca04ec74bdb41e079c885d99
2020-10-29 02:36:00 +00:00
DannyS712 21ec725c5a Update hooks to use PageSaveComplete
Extension requires MW 1.35+, always available

Bug: T250566
Change-Id: I43d76880557dd794540147503c7c94091c7b847a
2020-06-23 19:36:44 +00:00
DannyS712 f0e26d680b Remove use of Revision::newFromTitle
Bug: T249183
Change-Id: I0532af197c7bf4ae88c85c27cdfb5e55ea46feb3
2020-04-04 04:10:13 +00:00
DannyS712 b8b0e23632 Pass a user when creating a new ParserOptions
Bug: T246861
Change-Id: Ib516006f0a02c26da50d2a865242adc5cc65be9e
2020-03-04 08:08:26 +00:00
jenkins-bot f5f9c0971d Merge "Remove unused return values and reduce code complexity" 2020-02-09 17:27:11 +00:00
Ammar Abdulhamid 07a2824630 Replace deprecated IP class with IP Utilities
* Also bump required MW version to 1.35.0

Bug: T242556
Change-Id: I279e7d83a0dc75414117208ed23f8cc6b729eb19
2020-02-09 08:23:02 +01:00
Thiemo Kreuz 0dfd1f4ed1 Remove unused return values and reduce code complexity
Changes:
* Do not return anything in a method that is not expected to return
  something.
* Inline some previously hard to read code.
* More specific type hints, if possible.

Change-Id: I0e460899eea07d8733f638a11133adc3000f0542
2020-02-03 15:37:32 +01:00
jenkins-bot efadd21e76 Merge "Stop passing objects by reference" 2020-01-19 16:43:11 +00:00
Max Semenik 9380fa050e Stop passing objects by reference
Bug: T193950
Change-Id: I8c4aabe75ffce55f81c7ffb0f76b67155db1f761
2020-01-17 20:08:16 +00:00
DannyS712 affb6a238e Remove use of global $wgUser
Bug: T242936
Change-Id: I618b223ba9a1d0c9944bb171ffff345ae8e512ed
2020-01-16 01:28:02 +00:00
libraryupgrader 54f6c6d87e build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: Iba0ed9df5be4a7fbedce377556c87d42bddfb509
2020-01-14 04:33:04 +00:00
libraryupgrader d481d0c8db build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Additional changes:
* Added .eslintcache to .gitignore.
* Fix wrong types

Change-Id: I833b061c62b82f3c88d968c70bae8317641aaa3d
2019-12-27 14:42:40 +00:00
Daimona Eaytoy 7297235b2a Pass correct type to constructor
Although there was no docblock on CaptchaAuthenticationRequest::__construct,
the method is supposed to get a string and an array, as that's how the
class members are documented and used. Trying to access offsets of null
resulted in PHP notices on PHP 7.4, as seen in the experimental job
for various repos.

Bug: T239726
Change-Id: Idd073ebf3d560543ec225479de060e3c198847eb
2019-12-03 19:30:55 +00:00
James D. Forrester d0d036ea50 Drop use of wgParser, replaced in 1.32 and to be removed in 1.35
Bug: T160811
Change-Id: I6147fc4aa6d004cd848c170750a740091c336012
2019-10-28 20:12:00 +00:00
RazeSoldier dd1ccc92ea Enable OOUI in SimpleCaptcha
If we use it without OOUI enabled, an exception will be thrown

Bug: T232129
Change-Id: I46ee483b67776fa528a0267cfcafb1b0cee1a670
2019-09-07 17:46:09 +08:00
Aaron Schulz 82d48cae8c Switch to using BagOStuff::incrWithInit()
Change-Id: Ia82d9985f3f416ccbb5d7414848cc5b894635ca4
2019-08-09 16:50:55 -07:00
Derick Alangi 4a1c8bbfbd SimpleCaptcha: Avoid usage of deprecated wfGlobalCacheKey()
Deprecated in 1.30 and makeGlobalKey() on a BagOStuff was available
since 1.27. This extension requires 1.31 so the migration seems fine.

Change-Id: Ia7b276ee65fdf58c4fc0859563930528d44a03ca
2019-07-18 17:40:04 +01:00
Derick Alangi 92b41aa481 Avoid usage of deprecated ObjectCache::getMainWANInstance()
Replacement with services made available in 1.28 and this extension
requires 1.31. So, the replacement is good.

Change-Id: Idd5dda1e7cfa34b71ffb13446eb0f9e4f113f678
2019-07-03 13:43:23 +01:00
jenkins-bot bdefccfd6c Merge "Fix bug in Captcha::confirmEditMerged which breaks the $wgCaptchaRegex check" 2019-05-26 10:42:22 +00:00
Umherirrender 72900c1ac5 Improve param docs
Change-Id: Ie0619f6f946e651df9c102f0f4f305c15b10eab4
2019-05-23 21:16:12 +02:00
Porplemontage e8c475dc8d Fix bug in Captcha::confirmEditMerged which breaks the $wgCaptchaRegex check
Change the passing of $section to an empty string instead of false to properly comply with its type and the check in Captcha::loadText

Bug: T211848
Change-Id: I0555f7fbe246b0a4741759aee5b265b4f2cc3843
2019-05-22 22:33:53 +00:00
Florian a46515f782 Do not ignore message parameters
The return value of the getMessage function is intentionally a Message
object (which can have different stuff, be a RawMessage or contain
parameters. Just getting the key of the message, passing it to another
function which just creates a new message out of it, doesn't make sense
and breaks the original intention of the method.

This is now fixed by this change.

Bug: T222590
Change-Id: Id8ebba6b8239e6eee4be698680edcafad6c86cb0
2019-05-18 21:27:16 +02:00
Umherirrender 9bc797453e Swap ternary check for if statement
isset is not needed to check for null
and if is used, because the else branch is not needed

Change-Id: I3069ac43911101aa500c4897d419dca68f968040
2019-03-14 19:54:36 +01:00
libraryupgrader 87715809bb build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I4650b34b2c6d18cae2bf4650aaf423810fb96457
2019-02-06 12:04:20 +00:00
Ed Sanders 423234cb77 Convert SimpleCaptcha to OOUI
Change-Id: Ic904b53b2ac489be572f4b6096ddc8c92c482a59
2018-12-12 11:51:38 +00:00
C. Scott Ananian 7b4a11d0ca Replace deprecated OutputPage::parse()
The OutputPage::parse() method emits untidy output and is often used
with the wrong user interface/content language selection.  Replace
with Message::parseAsBlock() which was tidied in
I0f417f75a49dfea873e9a2f44d81796a48b9f428.

Bug: T198214
Change-Id: If1f0887ccd447e725fafbfcd842866c35ebb1a7e
2018-10-26 18:57:57 +00:00
C. Scott Ananian d22d1e88f4 Replace deprecated untidy OutputPage::addWikiText() method
The replacement OutputPage::addWikiMsg() method is ancient, and so
no bump to the minimum required MW version is needed.

Bug: T198214
Change-Id: I082bfb4585632dc37464d04aa93938ca05a9fdd0
2018-10-17 12:46:25 -04:00
C. Scott Ananian 0312de771d Only expand {{...}} in messages once
If we're going to call `OutputPage::addWikiText` to parse the message,
we don't need to pre-expand `{{...}}` markup using `Message::text()`
before passing it to the parser; `Message::plain()` works fine.  This
makes these callsites consistent with how `OutputPage::addWikiMsg()`
inserts messages.

Bug: T206574
Change-Id: Ic6e9c24139613f9c46e814f630c08d5a52789032
2018-10-11 09:32:49 -04:00
libraryupgrader f852bdb403 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Change-Id: I69c8746bafc4f0a39cc007db6a221d206c89c522
2018-09-03 00:12:31 +00:00
Stephane Bisson 93818fe9d1 Make shouldCheck public again
Follow up Ie956fe86184535a376d0398483ac3c853fa9127c

Make SimpleCaptcha::shouldCheck public since it is
called by Flow/includes/SpamFilter/ConfirmEdit.php(35)
and is now failing in production.

Bug: T199811
Change-Id: I85a813aaa06b896266c320089e24ca2e5e81d0ee
2018-07-17 11:27:48 -04:00
Max Semenik 5b7a36a521 Clean up some phpcs problems
Change-Id: Ie956fe86184535a376d0398483ac3c853fa9127c
2018-07-12 23:13:58 +00:00
libraryupgrader d80dc20133 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I325d3664bb6087ed457031bf7ec5301d2fae823c
2018-05-26 01:41:30 +00:00
Eddie Greiner-Petter 2848a699db Move "can user skip captchas" check to own function
As a direct effect
- sending emails and creating accounts now respects $wgAllowConfirmedEmail
- log messages get a bit less verbose for mail sending and creating
  accounts (but should be clear from the context what action was
  performed)
- less code duplication \o/

Indirectly, this should make solving the attached bug easy(tm), because it
just needs to add a hook to the canSkipCaptcha function.

Bug: T176589
Change-Id: Id27b0eadbab7300b9e6969d406fa6f00ef0888bf
2018-05-19 13:27:04 +00:00
jenkins-bot 7aae3b655b Merge "Allow other extensions to setup triggers using attributes" 2017-10-24 17:49:56 +00:00
libraryupgrader c683a83c29 build: Updating mediawiki/mediawiki-codesniffer to 14.1.0
And moved phpcs.xml to .phpcs.xml (T177256).

Change-Id: I8c46c34b0282294e2f7c3669e4bb86fd9f47906e
2017-10-21 04:19:58 +00:00
Umherirrender 1254022153 Improve some parameter docs
Change-Id: Idce2db0b489c19ec9b936cfc4ced3792e6f9711d
2017-09-24 12:14:11 +00:00
libraryupgrader 8b439b582d build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I155f72352224f230e94950f149fba400f26cbe6c
2017-09-24 10:04:06 +00:00
Florian Schmidt 50bc57a200 Allow other extensions to setup triggers using attributes
Instead of misusing the config section of extension.json to declare
captcha triggers in the ConfirmEdits CaptchaTriggers config variable,
other extensions can now use the CaptchaTriggers attribute for the
exact same thing. E.g., to declare a new trigger, the following
addition to the own extension.json will register the trigger in
ConfirmEdit:

  "CaptchaTriggers": {
    "wikiforum": true
  }

This also removes the CaptchaClass config from the main extension.json
config section, and automatically sets the SimpleCaptcha module in the
getInstance() method of ConfirmEditHooks, which is a pre-requirement for
the mediawiki/core change Ieeb26011e42c741041d2c3252238ca0823b99eb4.

Bug: T152929
Change-Id: I4c5eaf87657f5dc07787480a2f1a56a1db8c714f
2017-09-02 17:45:26 +02:00
libraryupgrader 61e4e142eb build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.MissingReturnType
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.OneClassPerFile.MultipleFound

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment

Change-Id: Id3af93f7485712b063b758cbd40752c1bfcb0b2e
2017-09-01 04:47:36 +00:00
Kunal Mehta cb2a80dab7 build: Update mediawiki/mediawiki-codesniffer to 0.11.1
Change-Id: Ie1307df0f85cf0ccb7ad24961df7b63005f9c745
2017-08-16 01:37:58 -07:00
Umherirrender 1d60bc25d2 build: Updating mediawiki/mediawiki-codesniffer to 0.10.0
Change-Id: I8d107ad6801fe1a5ce7b8feb8e1e730d504a2fb3
2017-07-08 16:04:35 +02:00
Timo Tijhof a480d98b3f Fixup use of $ceAllowConfirmedEmail
Follows-up 37f2dcf. confirmEditSetup() maps it to the new name so any use of it within
the extension can safely be replaced.

* Fix Catpcha.php.
* Update README.md.

Change-Id: I4b23954eba2d7d3e86e4f60d8189e263b864fbd3
2017-04-28 18:58:44 -07:00
Reedy 55949565bb Remove pre-AuthManager support
Bump version to match

Fixup some whitespace. Fixup some function level documentation

Change-Id: I72fa5e3f68c0c3de3f3ddae2fb16ba5fad6a67b2
2017-02-17 13:26:46 +00:00
Reedy ebadcd68bf Remove trailing . from log message
Change-Id: I57b55ab3f247ace4ba4ef47b71383af7e8cef802
2017-02-09 20:04:26 +00:00
Florian Schmidt 800f6cb1b8 Simplify function Captcha::loadText for readability
* Move globals definition to the top of the function
* no else needed, if the if part returns always returns something

I came across this while reading the code in I3a56e4252bbb810c1cf5c632ece9a8edf91c8424

Change-Id: I826a41457667e886b65a07d9d9edc5daec7d1013
2017-02-08 01:50:34 +00:00
Brad Jorsch 8bfc15c729 Replace use of &$this
Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.

Bug: T153505
Change-Id: I065808a2c4dc9bcb80861a79b46cf4b446b70d65
2017-01-31 22:51:00 -05:00
Roan Kattouw 28b5e66162 Follow-up 54b4d1e345: fix fatal when $rev is null
Found by ETonkovidova on the Hebrew beta labs wiki.

Bug: T151973
Change-Id: I3a56e4252bbb810c1cf5c632ece9a8edf91c8424
2016-12-12 16:21:25 -08:00