Commit graph

13 commits

Author SHA1 Message Date
Darian Anthony Patrick
a0616269a1 Check for link-local addresses in isPublic
Bug: T102032
Change-Id: Id1b6b9efc2c47a94a1a81cf4479cd756d22a2c80
2015-06-10 12:14:57 -07:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Reedy
7b20bb4401 Add IP::isInRanges()
cf https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/throttle.php#L43-L58

Change-Id: I8ae145035de9d349710971f17551da637e4d2242
2014-11-28 16:51:33 +00:00
umherirrender
d435aa2c58 Fixed some @params documentation (includes/utils)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: I9bd4ef370016cbbcce42d2612031a264eb3de61b
2014-07-21 20:58:14 +02:00
Aaron Schulz
34cb13e6b0 Renamed $ipSet static variable in IP to something better
Change-Id: Ie7e049c9b114d2a76e1e8e985c3500bda4bbc0ef
2014-06-03 10:42:56 -07:00
Aaron Schulz
96c5cd8d9b Removed clumsy unused IP::toUnsigned() method
* Also avoid calling ip2long() on invalid addresses in toHex()
* Also use native base_convert() in toHex() for IPv4

Change-Id: I4fe4e1ac3c91edb9812e4c5bd173e4b54e315934
2014-05-31 00:20:27 +00:00
Aaron Schulz
8eb6ac3e84 IP class cleanups
* Removed clumsy and unused toOctet() method
* Avoid internal use of ugly toUnsigned() method
* Use proper return value for toHex() on failure
* Converted isPublic() to use IPSet

Change-Id: I36d0e08fe96f15380aea77ad4a39e93104023ce3
2014-05-16 10:41:05 -07:00
Brandon Black
e323bc3393 Speed up CIDR matching from $wgSquidServersNoPurge
This adds a new generic library class IPSet, which precomputes
a reasonably-efficient data structure from the input list of
addresses and CIDR net/mask specs for fast runtime matching,
and then uses it to check trusted XFF-setters.

See also: 32b4f19f173fc5cff1029eedee63a39a2d72dd3a
Bug: 57021
Change-Id: Ia3b12fb90c3e7e492374a128943b014481cc2730
2014-05-15 17:23:12 +00:00
Aaron Schulz
ed6abd6b04 Workaround ip2long limitation
* This was resulting in bogus queries that did ipblock table scans

bug: 60035
Change-Id: Id8f8846e002abcc0010c8706c664db86257786bf
2014-01-17 00:23:49 +00:00
Aaron Schulz
6640bdf0d8 Removed deprecated functions and merged ProxyTools into GlobalFunctions
Kept wfGetIP() for now because it is still in use in the SecurePoll
extension and in WMF configuration.

Change-Id: Id412e37743f89bb67eb329a2f475f8496cf7b006
2013-12-16 12:54:16 +00:00
Siebrand Mazeland
655a03d26f Update formatting
Change-Id: I5ec6257295261caab6cb2d9eb9d32ce76cae08a2
2013-11-04 10:29:25 +01:00
Tim Starling
e4bcbe722e Introduce includes/utils directory
These are classes that provide facilities for use by any caller, are
independent of user interface, and have a limited set of dependencies on
the rest of MediaWiki. See the README file for a more precise
definition.

These classes cannot go in includes/libs because of a dependency on the
MediaWiki framework, such as wfDebug() or MWException, but they are
otherwise similar. I thought it would be useful to put them in their own
directory, to make them more discoverable, and as part of a general
program of reducing clutter in the base includes/ directory.

I've probably missed a few classes which could be included here, but the
following classes were considered and were rejected for now:

* Fallback: single caller only
* GitInfo: getViewers() has inappropriate dependencies
* HttpFunctions: depends on configuration, $wgTitle
* PoolCounter: depends on configuration
* CacheHelper: depends on IContextSource, wfMemc()

Also moved a couple of classes into libs/ instead, where that seemed to
be more appropriate.

Change-Id: I274cff805b7d694b728a89b764a049cd62d320fe
2013-11-04 11:00:42 +11:00
Renamed from includes/IP.php (Browse further)