Commit graph

71 commits

Author SHA1 Message Date
Alexander Vorwerk 16fcb03340 Run ConfirmEditTriggersCaptchaHook under correct name
also fix the var name to match the one in the interface

Bug: T303433
Follow-Up: If48689fe068aa3ec56e51e01b84cf25c63bcbf0b
Change-Id: Ie47b98d08cba5217f8661aa44f6331447575d7ae
2022-08-04 21:45:01 +02:00
Kosta Harlan aca8deafb1
phpunit: Check for MW_PHPUNIT_TEST constant
$wgWikimediaJenkinsCI may not be enabled in LocalSettings.php.

tests/phpunit/phpunit.php reads this global, but vendor/bin/phpunit does
not.

Bug: T90875
Change-Id: I91628f0e63d4f67d1d3060cca3a17b95e0faf826
2022-07-12 18:44:01 +02:00
Alexander Vorwerk 607452ef05 Add new ConfirmEditTriggersCaptchaHook
This allows the dynamic activation of CAPTCHAS triggering without the
need to change the configuration.

This lays the foundation for stewards to later be able to activate
'emergency captchas' via an on-wiki interface.

Bug: T303433
Change-Id: If48689fe068aa3ec56e51e01b84cf25c63bcbf0b
2022-06-30 18:59:45 +00:00
Alexander Vorwerk 54d07d494e Add missing use statement in ConfirmEditHooks
Change-Id: I9f4e1fd82ee569ffb00de334a2ec02df5e166b31
2022-06-13 09:29:56 +02:00
Jon Robson 8b36b3be43 Use Html::warningBox instead of hardcoded class
Bug: T304272
Change-Id: Ic77910718d329401b25f178b50172d1fe7d5c8a3
2022-03-24 11:03:48 -07:00
Reedy bc400cc07e Update documentation for ConfirmEditHooks::onEditPageBeforeEditButtons
Fixes phan issue

Follow-Up: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
Change-Id: I05f1ba79fb557a12c4ffb5709430849847273679
2022-03-11 21:13:18 +00:00
Umherirrender 0beb466cf7 build: Remove unneeded phan suppression
Bug: T290624
Change-Id: Ib7e9801977e6f27189952d23f96eb644a4e289d8
2022-02-12 00:35:22 +01:00
Reedy b24721bb96 Suppress SecurityCheck-DoubleEscaped in ConfirmEditHooks::onAlternateEditPreview
Bug: T295708
Change-Id: If9018f4bc5c2df11a7ac48c3f26a6e0f1b6835e3
2021-11-16 14:51:35 +00:00
libraryupgrader 5a256ffa65 build: Updating composer dependencies
* mediawiki/mediawiki-phan-config: 0.10.6 → 0.11.0
* php-parallel-lint/php-parallel-lint: 1.3.0 → 1.3.1

Change-Id: If86cb3cf74e27abd544aefc15a7579dd554fe419
2021-09-08 23:10:31 +00:00
libraryupgrader 81a524e2e9 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.0 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I57837ebf8054a2e968d207fecb3f12397c18e2a2
2021-07-22 14:24:25 +00:00
James D. Forrester 4e62a8f53e Update ConfirmEdit hook running to use HookContainer, partially
I've left alone the pass-through hooks into the sub-extensions for now.
That'll be the next patch

Bug: T269882
Change-Id: I62eedd4afc36b4610a138b84b02d2cc48ce0ae2f
2020-12-13 08:52:18 -08:00
libraryupgrader a38c96140e build: Updating mediawiki/mediawiki-phan-config to 0.10.4
Change-Id: Id88999106d58d86395b6d60635c7005a28d16f0b
2020-11-20 03:04:10 +00:00
Ed Sanders bdacb3ab91 Suppress new phan error
Change-Id: I7da42e0fa83228474b6b9fae9e2bd2fe4be1e835
2020-07-01 15:41:55 +01: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
libraryupgrader e2bfe91518 build: Updating mediawiki/mediawiki-phan-config to 0.10.2
Additional changes:
* Removed phan-taint-check-plugin from extra, now inherited from mediawiki-phan-config.

Change-Id: I72d3324ef9565b6ed8b4ab79ee4451495349499a
2020-06-02 11:15:21 +00:00
Bartosz Dziewoński f786536715 Extract CaptchaInputWidget from VE code for use in other extensions
* ext.confirmEdit.CaptchaInputWidget.js:
  Based on code from ve.init.mw.CaptchaSaveErrorHandler.js

* ext.confirmEdit.CaptchaInputWidget.less:
  Based on code from mw/ext/VE repo in ve.ui.MWSaveDialog.css

* ConfirmEditHooks.php:
  Based on code from mw/ext/VE repo in VisualEditorHooks.php

Change-Id: I6605017fd31a4f96c529dd0beb69e9f4433cebc1
2020-04-15 16:06:58 +02:00
Reedy d648372f7f Fix MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
Change-Id: Idc03460327095e19438fd9a3a542bf4229db4be2
2020-04-15 00:45:00 +01:00
Reedy 274e6079f8 Fix PSR12.Properties.ConstantVisibility.NotFound
Change-Id: Ib76375fed58fddb1f96728dd2baeec08e222dc83
2020-04-15 00:25:50 +01:00
Reedy e5d3a17263 Drop $ceAllowConfirmedEmail
I think well over 2 years is long enough!

Change-Id: Ia3770fe4d257df30b6dd244405d4943099cf8464
Follows-up: If4daf6f25f0d2b2c0f1e173ee3903063a39978bb
2020-03-08 16:17:30 +00:00
Reedy 035e073ddb Don't use logging reserved word 'ip' as parameter
Bug: T245280
Change-Id: I368724e9e6de85df45fd8734668789e8d524214f
Follows-up: I5f602bc08902b63acbb0752093b418d0ab063493
2020-02-27 15:11:16 +00:00
Brian Wolff bb0a85ea5e log login captchas to "captcha" channel instead of "authevents"
Also makes the log events more useful by including the username
in question and fix logging logins as being account creations.
See also Icde984d27.

Bug: T210817
Change-Id: I5f602bc08902b63acbb0752093b418d0ab063493
2020-02-11 09:04:55 -08: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
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
Daimona Eaytoy 2971bace15 Remove redundant reference from EditPage hook handler
Bug: T234118
Change-Id: I0f6305bf881c7ffb4383568730f24f89388ae897
2019-09-28 13:05:39 +00: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
Florian fe6d078b9f [recaptcha] Remove the ReCaptcha module
It's not supported by Google for a while.

Bug: T223749
Change-Id: I159cdd4882c1de48d6cee359faa153a2e6e0424b
2019-06-22 10:38:39 +01:00
Umherirrender 7f76ef9924 Add phan
Change-Id: If382ed4440aa96dcb32a8aba6726cc7e78f0e0a7
2019-05-28 21:05:39 +02:00
Umherirrender ca72ab9a21 Document CaptchaStore to store arrays
SimpleCaptcha::storeCaptcha is passing an array to CaptchaStore::store,
so allow to store arrays
The implemenation allows to store mixed

Change-Id: I24bb8d852475c054c179a8c8d48417d8983797fa
2019-05-26 22:19:03 +02:00
Derick Alangi 7e97119a91 store: Avoid deprecated use of ObjectCache::getMainStashInstance()
And also, avoid deprecated use of wfMemcKey() global function. So,
create a BagOStuff cache object and use. ::getMainStashInstance() was
deprecated in 1.28 and the MainObjectStash service was marked available.

Currently, extension requires MediaWiki 1.31 at the minimum so the
replacement is safe.

Change-Id: I01494a2dcbcbf30fe9960fdfb55b4912a648c7b6
2019-05-08 22:59:16 +01:00
libraryupgrader 223ff14572 build: Updating mediawiki/phan-taint-check-plugin to 1.3.0
And updating CoC link to use Special:MyLanguage (T202047).

Change-Id: I9830f95de17383a7f4fba6f323550bc9061acc06
2018-08-19 12:06:19 -07:00
Max Semenik 5b7a36a521 Clean up some phpcs problems
Change-Id: Ie956fe86184535a376d0398483ac3c853fa9127c
2018-07-12 23:13:58 +00:00
C. Scott Ananian bcc9f5a9e2 Replace uses of deprecated Language::truncate()
See I2291c69d9df17c1a9e4ab1b7d4cbc73bc51d3ebb for the anticipated
hard-deprecation of this method in core.

Bug: T197492
Change-Id: I08b5c7b0c8cc1b88f07163cfd412e5d7e87c56f3
2018-06-16 09:24:51 -04:00
Umherirrender 8a3c51b1db Move classes to own files
Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass

Change-Id: I88b5112d84d8983e67be1bca9f4039486bcefc6f
2017-12-16 13:32:46 +01:00
jenkins-bot 7aae3b655b Merge "Allow other extensions to setup triggers using attributes" 2017-10-24 17:49:56 +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
Florian Schmidt 37f2dcfd23 Rename $ceAllowConfirmedEmail to $wgAllowConfirmedEmail
The value of $ceAllowConfirmedEmail is copied to $wgAllowConfirmedEmail if
set in LocalSettings.php for backward-compatibility. However, a deprecation
warning is emitted in this case.

Bug: T162641
Change-Id: If4daf6f25f0d2b2c0f1e173ee3903063a39978bb
2017-04-17 19:26:37 +02: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
Gergő Tisza bbc318fb51 Rename 'type' field of authevents channel to 'eventType'
'type' is problematic as it conflicts with a default field name
in logstash.

Bug: T145133
Change-Id: Idb73ba3e431ef2bd25b14c8562d1b3f212b4e072
Depends-On: Iab1eb47a6b6c98f3c84b4f8e2d16cbe2cdbf515b
2016-11-26 01:12:58 +00:00