Commit graph

43 commits

Author SHA1 Message Date
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
Reedy
a8467a0fd7 Fix numerous PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I157220c4e9ff516283a60f06af99efa2439332e3
2020-05-12 18:41:43 +00:00
Kunal Mehta
99007e96c7 Use namespaced IPUtils class
Change-Id: I047e099a93203a59093946d336a143d899d0271f
2020-01-01 02:36:49 -08:00
Daimona Eaytoy
9881ea93be Better grouping for code adding elements to arrays
Change-Id: I7cc8c810f0dcf1ee84b9d5f14967ec2568e3e0be
Follow-up: I50377746f01749b058c39fd8229f9d566224cc43
2019-09-03 19:38:57 +02:00
Daimona Eaytoy
e2e543f7c2 Unsuppress more phan issues (part 5)
Bug: T231636
Depends-On: I6e5fba7bd273219b1206559420b5bdb78734aa84
Change-Id: I50377746f01749b058c39fd8229f9d566224cc43
2019-09-01 09:48:31 +00:00
Umherirrender
54190757bb Unpack arrays on variadic arguments
This avoids extra handling in the function to unpack an array

Change-Id: I93277599bc8125e23fca53d43a728fb7e9e39aad
2019-08-31 23:23:50 +00:00
Matěj Suchánek
68e8323160 Fix some docs
Discovered by phan.

Change-Id: Iadc2b151db6922f3159f061f10408d45636967c5
2019-05-22 21:50:52 +02:00
Bill Pirkle
d993f499ee Refactor calls to deprecated function Content::getNativeData()
Function Content::getNativeData() was deprecated.  Replace with
calls to new function TextContent::getText() in most places.

Bug: T155582
Change-Id: I2bd508c72aac4faf474ba45ab1f92e2e8d2eb9be
2019-02-15 17:48:01 +00:00
Brad Jorsch
d65e96b763 Use new externallinks.el_index_60 field
This adds a method to LinkFilter to build the query conditions necessary
to properly use it, and adjusts code to use it.

This also takes the opportunity to clean up the calculation of el_index:
IPs are handled more sensibly and IDNs are canonicalized.

Also weird edge cases for invalid hosts like "http://.example.com" and
corresponding searches like "http://*..example.com" are now handled more
regularly instead of being treated as if the extra dot were omitted,
while explicit specification of the DNS root like "http://example.com./"
is canonicalized to the usual implicit specification.

Note that this patch will break link searches for links where the host
is an IP or IDN until refreshExternallinksIndex.php is run.

Bug: T59176
Bug: T130482
Change-Id: I84d224ef23de22dfe179009ec3a11fd0e4b5f56d
2018-11-12 22:33:18 +00:00
Umherirrender
acb2e720d8 Pass delimiter to preg_quote
This ensure that the regex is escaped correctly,
even when the quoted value never contains the delimiter

Change-Id: I2dc93fa0154d4506c276a30cab008bc2ac5e0687
2018-09-01 14:52:16 +02:00
Reedy
0a1144fb2a Make cleanupSpam.php query for http and https
Bug: T186795
Change-Id: I9e350306f85d3d3ca4daba626e49a0792605acc7
2018-06-03 22:00:11 +00:00
Kunal Mehta
d1cf48a397 build: Update mediawiki/mediawiki-codesniffer to 0.10.1
And auto-fix all errors.

The `<exclude-pattern>` stanzas are now included in the default ruleset
and don't need to be repeated.

Change-Id: I928af549dc88ac2c6cb82058f64c7c7f3111598a
2017-07-22 18:24:09 -07:00
Aaron Schulz
a57af76a0f Move LikeMatch to Rdbms namespace
Change-Id: I0cba263cd02fc5c4bfe8f063f38d1b4be28246b0
2017-02-06 21:20:39 -08:00
Kunal Mehta
141bce2b8e LinkFilter: Fix return types in phpdoc
Change-Id: I870d348a1515ce9ad5b15fe65354919c46c96e54
2016-09-06 14:51:47 -07:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Aaron Schulz
7c07943eab Update more docs and type hints to use IDatabase
Change-Id: I8c8d85b32a8aba21e14d2a2dde4c25eb509186c1
2015-10-06 18:49:52 -07:00
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
Aaron Schulz
ed2273fdc5 Avoid using DB_MASTER in makeLikeArray
Bug: T92357
Change-Id: Ifd134f8572a247d6d977fdb36fb2814bc51e7fbe
2015-03-27 17:58:57 +00:00
umherirrender
8ad1c92441 Fixed some @params documentation (includes/*)
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.
Also added some missing @param.

Change-Id: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
2014-04-20 21:16:57 +02:00
umherirrender
5ca5672aac Fixed spacing
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs

Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
2013-12-01 20:58:51 +01:00
mrbluesky
d4d6819a75 (bug 40588) LinkSearch cannot search with a port in the url
Special:LinkSearch doesn't handle urls with a port correctly.

The detection of the protocol to search for (in LinkSearchPage::execute()) cant handle
the extra colon a port introduces in the url. Fixed by making LinkSearchPage::execute
use wfParseUrl() to detect the protocol.

LinkFilter::makeLikeArray didn't handle the port correctly too, putting it in the
domain part of the url. Fixed by rewriting makeLikeArray to make use of wfParseUrl().
This also fixes the problem of makeLikeArray not removing username and pass from
the search pattern.

Allow queries like 'ftp://*' or 'mailto:*' to find all links with specific protocols

Bug: 40588
Change-Id: Id3dd31993456bf6cbba4cf17962cf0083b612bed
2013-12-01 15:10:14 -04:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
umherirrender
9d19d7342a Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I7db616db8c969567d420c0161fa207b366e292b6
2012-10-19 22:03:05 +02:00
daniel
14ce85f58c Make LinkFilter handle Content objects
Change-Id: Iced1c83642143faa79a5461ae6278267e0595aa9
2012-08-21 17:54:52 +02:00
Alexandre Emsenhuber
a682b7335a Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I0db3461139284edcb6ac02923eb83d54e6756ffb
2012-05-12 22:33:51 +02:00
Sam Reed
f3cc77aaee Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:41:50 +00:00
Sam Reed
8c1c535466 Remove some stuff marked as deprecated <= 1.16 unused
Stuff still used left for the moment

Added some since to @deprecated

Added wfDeprecated( __METHOD__ ); in one case
2011-05-06 20:59:58 +00:00
Alexandre Emsenhuber
fc582f43aa * document a bit
* fixed some doxygen warnings
2010-01-19 22:02:20 +00:00
Tim Starling
a612b092cb Fix breakage of LinkFilter::makeLike() due to attempted rewrite in r60162. It's meant to return the string without the quotes, not the whole clause. 2009-12-18 02:49:07 +00:00
Max Semenik
eb8b230abc Fixup for r57989: removed artifacts of the previous version of my patch, improved code reuse. 2009-12-17 15:39:11 +00:00
Max Semenik
ae57ab1eec (bug 20275) Fixed LIKE queries on SQLite backend
* All manually built LIKE queries in the core are replaced with a wrapper function Database::buildLike()
* This function automatically performs all escaping, so Database::escapeLike() is now almost never used
2009-10-21 19:53:03 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Brion Vibber
bc20a5b531 Fix external link queries to escape LIKE metacharacters, avoiding massive table scans 2007-09-18 20:14:25 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Antoine Musso
894d10e075 make some methods public, static and private. Fix strict standards in cleanupSpam.php 2007-04-13 00:20:43 +00:00
Raimond Spekking
7a69366288 * (bug 8324) LinkSearch: search for all protocols defined in wgUrlProtocols incl. email
Make LinkFilter and GlobalFunctions more flexible
2007-03-19 16:19:13 +00:00
Raimond Spekking
ba14ef8ecd * (bug 8324) LinkSearch: search for https/ftp/irc/news weblinks
Make LinkFilter and GlobalFunctions more flexible for other than http
2007-03-16 21:49:43 +00:00
Lupin
c7408b9223 trailing whitespace removal 2006-03-11 17:13:49 +00:00
Tim Starling
34912bff40 Maintenance script to find and remove links to a given domain (cleanupSpam.php) 2006-01-27 23:37:19 +00:00