Commit graph

36 commits

Author SHA1 Message Date
Umherirrender 0cf9669e85 build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: Ibad3f653c0b78249eff781596c567182cce281c6
2024-03-11 19:29:34 +01:00
Umherirrender 7a424d1fdb Stop writing to tablesUsed in tests
Bug: T351733
Change-Id: I6bb37ef79caac7738e70eed54554790deb762149
2024-01-20 12:30:57 +01:00
Umherirrender 160368a296 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I8943e4e63fb41ca758c9ed25a4abb7664e13bb9f
2024-01-06 17:07:32 +01:00
Umherirrender 19c781b681 tests: Pass HideUserUtils to LocalIdLookup
Follow-Up: I408acf7a57b0100fe18c455fc13141277a598925
Change-Id: I4f0190b416873a2aae0c579750b4999ba91baa17
2023-12-15 23:31:12 +01:00
Tim Starling 6f32dafbc1 Use the new DatabaseVirtualDomains feature
Change-Id: I05b6361bd57ba6754bd308e04da1c635f95d042b
2023-10-26 14:50:22 +11:00
Tim Starling a0a387d195 Don't notify of failed logins for system or temporary users
Bug: T329774
Change-Id: I65fa3da22f45002e013d3bd5c8b0efda5f8b5edb
2023-09-04 17:01:52 +10:00
Tim Starling 534e3ce4b3 LoginNotify seen subnets table
Add a table which stores a summary of each user's IP address subnet in
each time bucket, defaulting to 15 days. On edit (and other changes
causing a recentchanges row) and successful login update the table.

On attempted login, check whether the subnet is in the table in any
time bucket back to the expiry time.

Add a job and a maintenance script for purging expired rows.

Disabled by default for now. The idea is to enable it by default after
we have some experience with using it in WMF production.

If CheckUser integration is disabled (the future intended state), the
cache and LoginNotifyChecks job are suppressed since they are
unnecessary.

Details:

* Rename setCurrentAddressAsKnown() to recordKnownWithCookie() and
  split off recordKnown() which does the same thing except without
  sending the cookie. We use recordKnown() to store the IP address
  without sending the cookie, on non-login changes.
* Reorganise isKnownSystemFast() for clarity, and return emphatic
  USER_NOT_KNOWN if the user is not in the table, cache or cookie
  and CheckUser integration is disabled.
* Replace time() calls with a mockable method.

Bug: T345052
Change-Id: Iea716e660353f16c47f873fe42edc2aeec1b4346
2023-09-04 15:04:36 +10:00
Tim Starling 4c369696cc ServiceWiring, dependency injection
* Make LoginNotify into a service. Use a static getInstance() method
  instead of a services container class, since there is only one
  service.
* Removed references to $wgLoginNotifyEnableForPriv. The feature was
  removed in I888c6009fffad1712.

Change-Id: I9120b470d27a0d09e508bd4e12eb2bde2f38d34d
2023-09-04 15:04:36 +10:00
Tim Starling a47af7c73d Fix deprecations and non-static providers
Change-Id: Ia267a93a13191a2289aff70d47c31b2afcb1647b
2023-08-25 15:10:07 +10:00
Tim Starling 3560438921 Add integration tests
Bug: T344785
Change-Id: I6d2d2502599938747aef0f02106afbea33c24e41
2023-08-24 10:38:49 +10:00
Umherirrender 222b7475fb Create HookRunner class
Only core hooks are run, but own HookRunner is recommended

Bug: T263353
Change-Id: I2506f4af21ef955a7feeb145d5173f46ca11b334
2023-06-05 22:47:00 +02:00
Umherirrender 76bf0ed8e3 tests: Make some PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: I659c128532ac8350ef8bac85141ffc71329f71b0
2023-05-21 00:12:25 +02:00
gerritbot 4974e8c1e9 Update moved class FauxRequest
See T321882. Moved in I832b133aaf61ee

Bug: T321681
Change-Id: I82d99b9826a5790a2f6a04db9298d732edb34293
2023-05-19 10:24:50 +00:00
Alexander Vorwerk f20844abc1 MediaWikiTestCase -> MediaWikiIntegrationTestCase
MediaWikiTestCase has been renamed to MediaWikiIntegrationTestCase in 1.34.

Bug: T293043
Change-Id: Id240511ba420b4a6c7c3200fc4efc3ac45e591c8
2021-10-12 21:53:04 +02:00
libraryupgrader 1b8445d690 build: Updating mediawiki/mediawiki-codesniffer to 37.0.0
Change-Id: I0a119437d963adaaed8bbeddae52279e12236e11
2021-07-23 01:54:17 +00:00
Umherirrender 3779f172d3 Remove incomplete @param from test function
the @dataProvider should be a enough here

Change-Id: If62bee2dec62d4deb2e7d5d3452f26c93a7e8348
2021-01-19 21:22:42 +01:00
libraryupgrader 4dc64245e8 build: Updating mediawiki/mediawiki-codesniffer to 31.0.0
Additional changes:
* Replaced "jakub-onderka" packages with "php-parallel-lint".

Change-Id: I7ac5d33b8fbf240c5169c2d001ca7aac2e555f6b
2020-05-30 00:25:34 +00:00
libraryupgrader 3103915e78 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: Ie0f3c44edd654994ca1aa3c55a40cbef22465c0b
2020-01-14 07:37:43 +00:00
James D. Forrester e4d9f1ea3e build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: Ide491f1971a4fe323f82eb5812a42fce990ddbd5
2019-10-11 10:39:00 -07:00
Max Semenik c5c9a60d15 Use expectException() instead of annotations
Bug: T234597
Change-Id: If10c7754589c358290154dbe4636024a76127162
2019-10-07 13:25:49 -07:00
Umherirrender 04aea49150 build: Remove .gitkeep from folder tests/phan/stubs
No need to keep this folder in the new version of phan-config

Change-Id: Id4acc0ee278a3ff3c3456e5379b63ec0d9770f18
2019-05-19 16:30:34 +02:00
Kunal Mehta c5d999a10d Upgrade to newer phan
Bug: T216926
Change-Id: Iadebf5698e8c15db0d0009bd66f55c3b534a192f
2019-03-17 16:17:46 -07:00
Kunal Mehta af1fa3b905 build: Updating mediawiki/mediawiki-phan-config to 0.2.0
Change-Id: I66f23d64bd2f2e938c014e8933c7551fb55b9f25
2018-04-05 17:14:46 -07:00
Umherirrender 866f1883b4 Remove unneeded @codingStandardsIgnore
* Break long lines
* Sniff fixed, see T178725

Change-Id: Iaeea06ece1c58f625dfdd3e0e9f6bd53351cc104
2018-03-29 16:09:33 +00:00
Umherirrender ec635fb94a Use mediawiki/mediawiki-phan-config to centralize phan configuration
Bug: T186315
Depends-On: Id531488e1c2bddce71946423010620323e08bc0a
Change-Id: I23fa6197e624fa9229d007d6f65e75b10dc16a20
2018-02-24 21:32:56 +00:00
Kunal Mehta d51ff1c159 Actually run PHPUnit tests, and fix the broken ones
It has to be named *Test.php to be run.

Change-Id: I707efb0a3418d36e32ca059845868e5d4f2fb3e1
2018-01-26 10:35:06 -08:00
Kunal Mehta 655456a8ed Add @covers tag
Change-Id: Ifb241ba3f2ec6c25eee812b5c36cc354e3164765
2018-01-24 13:59:52 -08:00
Max Semenik 3029d882a5 Add Phan config/make it pass
Test with
   phan -k tests/phan/config.php

Change-Id: I1d567e2a3b4e4834fd2bcf964d40c39740618122
2017-06-20 23:56:12 +00:00
Max Semenik f944f5daf9 Cleanup
* PHPDoc
* Deprecated functions
* Undeclared property

Change-Id: I91ef41257d9bb53e14fbe762ad41798acaa06bb0
2017-06-16 04:15:17 +00:00
Gergő Tisza f431bc7196 Switch TestingAccessWrapper to librarized version
Bug: T163434
Change-Id: I3bd4a725291c8d0d10ff002c481064fe67f8df39
Depends-On: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 19:16:16 +00:00
MusikAnimal bafd980e7d Rename functions so as to not confuse with with CheckUser extension
Bug: T162748
Change-Id: If2ad9d65cedc8124b2570e2b66574736a8f112f9
2017-04-18 16:30:48 +00:00
Kaldari 784bd9bd14 Changing cookie name to match cookie naming conventions
We typically do extensionname_blah, see CentralNotice and
CentralAuth cookies.

Also, "logins" is more accurate than "login" as it can store
multiple user login records (default is 6).

Change-Id: I1e20fc2bbc713613cfa27cf37fff371dbb0be25e
2017-04-12 14:47:18 -07:00
Kunal Mehta f58cec3a69 Move tests to tests/phpunit/ and remove hook
The UnitTestsList hook is no longer needed as tests are now
autodiscovered.

Bug: T142120
Change-Id: Ie4abce0cac28c408ed9ba5f4327912a3ca0c2925
2016-08-06 01:30:11 -07:00
Brian Wolff 8fa1401235 Follow-up fea1a38d - respond to Legoktm's comments
Also make a minor change to the default config options.

Change-Id: Icf295c50b6f834ec004c73213935679e409b65c5
2016-04-26 12:53:38 -04:00
Brian Wolff 78de4c6aa2 Fix phpcs warnings
Change-Id: Ice5ff0bd25c5e2af522965bf8229e64bce70b593
2016-04-26 12:48:00 -04:00
Brian Wolff fea1a38de5 Initial version of extension to notify people on failed login attempts.
Bug: T11838
Change-Id: Id96aff70f06879a7b754b19af8e65c0f641e84e0
2016-03-28 04:29:04 -04:00