Commit graph

13 commits

Author SHA1 Message Date
Andre Klapper 3ef5362f06 Use explicit nullable type on parameter arguments (for PHP 8.4)
Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.

Bug: T376276
Change-Id: I8e34f5e92cf8ae173ad34cc91caf9d2027c72bf4
2024-10-26 15:11:32 +02:00
Ebrahim Byagowi ef6ff77539 Avoid use of deprecated URL related global functions
Change-Id: I752d77c6c23f0cf8598d3759c73df29cd385652d
2024-09-09 09:50:19 +03:30
Umherirrender 3584fe6637 Add return type hint to function in ServiceWiring.php
This is a common pattern for service wiring functions

Change-Id: I7a5926c9e8c02fd628c974a1ada4f8e083f47e85
2024-01-31 21:27:30 +01:00
thiemowmde e5df1df69e Lazy load large domains.php file only when it's really needed
I have seen this popping up once in a recent flame graph. I think most
services should be designed in a way that they can be instantiated
very quickly and only start doing expensive stuff when we are sure we
really need it. This was not the case here. The file domains.php is
about 150,000 lines long and can take several 100ms to load in the
worst case.

Bug: T200758
Change-Id: I7c0c787230e8cff40e8e73fede0ac1dce63ea1ca
2023-06-14 22:19:40 -04:00
Umherirrender f49dab01a1 Improve performance of string operation on domain lookup
The benchLookup.php shows that the lookups take half the time as before,
without more memory

In the lookup use offsets instead of preg_replace to create the smaller
strings, also simplify the return

In the hook handler use str_starts_with to check start of string,
strpos needs to scan the whole string for a negative check,
but we need only need information about the begin

Bug: T316443
Change-Id: Ibc0cbe5f7f14bd56d4e126fa7ed183a807d9a99c
2022-08-27 19:35:03 +00:00
Kunal Mehta 0509d34225 Switch to new hook handler format
* Turn HSTSPreloadLookup into a real service, per @todo
* Convert Hooks into a non-static class, take lookup as an argument
* Update tests for new calling style

== Test plan ==
* CI/tests pass
* Use Special:ExpandTemplates with a preloaded domain and localhost,
  observe preloaded link changes, localhost stays http

Bug: T271027
Change-Id: I0196350e85c09eedfba4dbf1dab81f9a757b2a12
2022-06-05 12:12:39 -04:00
Reedy 2e20b3edcd Fetch list from GitHub
For some reason Mozilla is blocking our requests from Toolforge,
using GitHub is something we know that works and should be the
same in practice.

Bug: T292242
Change-Id: Ic7d5da9758122ecb36f5e8f43716b4f8cf6f889d
2021-11-24 21:56:13 +00:00
libraryupgrader 15b45eebb4 build: Updating mediawiki/mediawiki-codesniffer to 37.0.0
Change-Id: I8a4158927f9029b069686d39e5e6978cf36106f3
2021-07-24 01:58:33 +00:00
Kunal Mehta dfa2506116 Update Legoktm's email address
Change-Id: Ic20c6d24d221fd5377bfa4a36a7f0ee034fad9e1
2021-04-11 19:10:07 -07:00
Kunal Mehta 19dfb75a1e Move the logic from fetchList.php into a PHP class for easier reuse
Change-Id: If01182c89a5db85fde27b36570b17694b1234871
2019-12-28 17:33:07 -08:00
Kunal Mehta 6ac715971e Fix weird spacing
I'm not sure why I did this

Change-Id: I86302d8c1e6f619f9493c1779714cb905a0b526b
2018-08-01 21:40:16 -07:00
Kunal Mehta f0ed5222ff Refactor out a HSTSPreloadLookup class plus tests
Makes it much easier to write tests, and do potential further
refactoring.

Change-Id: I072951bb2bc87639e076d03c233f7283c0b175ff
2018-08-01 21:23:49 -07:00
Kunal Mehta e436b78837 Initial commit
Change-Id: I2c8efb613632ce785580e8fba4da5b0a3a36a0f6
2018-07-29 19:01:06 -07:00