Commit graph

253 commits

Author SHA1 Message Date
MusikAnimal 541fd57e46 Don't escape text in some messages so that admins can add links to external tools
Admins already have the ability to edit site JS, etc., so I don't think we should be concerned about malicious content

This patch allows markup in all messages in the edit interface, except the labels for the checkboxes

Bug: T157235
Change-Id: I5f1a2cd536a2c7ec5f7a5d7afbf124104bfcd975
2017-02-06 22:35:45 +00:00
Matěj Suchánek 16e71d3985 Cast stashed values to integer
Stash may return false if the value hasn't been set yet. This basically
means 'zero'.

Steps to reproduce: create a new filter and open it. If it doesn't have
any hits, the second message parameter is missing instead of being '0'.

Change-Id: I8f240dd87664ec99a98b843f9e5c4c8c9eed0532
2017-01-02 08:47:13 +00:00
Matěj Suchánek 0dca928f58 Don't show link to testing interface when the user cannot test filters
Clicking on this link only shows an error message unless the user can
edit filters.

Change-Id: Id912731e98f0f37b999d4a8e7ab190cd938825aa
2016-12-16 20:24:04 +00:00
jenkins-bot db896921da Merge "Make more fields sortable and one conditionally" 2016-12-12 20:03:45 +00:00
Matěj Suchánek 95989575cc Make more fields sortable and one conditionally
Users can now sort filters by whether they are visible and which group
they belong to. Sorting by hit count is only possible if the user can
actually see it.

Change-Id: I516111f96b9ef0beaa0c04f902e03712591371d1
2016-12-12 14:21:05 +00:00
Matěj Suchánek 8d10972f93 Don't show hit count field if it's always empty
If the user cannot see hit counts, this field is always empty, so there
is no need to have it shown.

Change-Id: I27c8639f901a3c7fa686378a1205b2ddebb7d665
2016-12-12 14:19:04 +00:00
Matěj Suchánek 3e6605c94b Check whether user is allowed to see the hit count
Bug: T120562
Change-Id: I464fc4806b52327a58fddb54404f5869c8431194
2016-12-10 12:06:43 +00:00
Subin Siby f4ddf5dd23 Replaced Linker::link() & Linker::linkKnown() with LinkRenderer
All usages of Linker::link() and Linker::linkKnown() has been replaced with LinkRenderer

Bug: T149346
Change-Id: Id087fe2aeaae81445e83e020ef66b541d9da4060
2016-12-06 23:21:31 -08:00
Matěj Suchánek b00d91605e Don't pass unsupported parameter
Change-Id: I40317c3e64eb3c96862991e49fc4b2041247779c
2016-12-02 18:23:15 +00:00
Kunal Mehta 9eb50de025 Avoid wfMessage() in AbuseFilter::buildVarDumpTable()
Change-Id: I3377623e6ba7f4c203de69d25f677162d6e61e65
2016-09-17 00:27:38 -07:00
Paladox b3081e1798 Update mediawiki/mediawiki-codesniffer to 0.5.1
Change-Id: I4b2055a76db4362a8136e3fd595228cf07d083a9
2016-08-23 16:18:27 +02:00
Kunal Mehta 972d9b7c0f Fix User::isAllowedAny() calls
Follows up bb277d437e.

The permissions are supposed to be passed as arguments, not in an array.

Change-Id: I50ab80e4fec0d3a983d4cd3957d340abd04126c4
2016-08-22 16:30:59 -07:00
Platonides bb277d437e Let abusefilter-modify users see history of hidden filters
d0439337 (I9e15326c) made abusefilter-view-private required
even for users with abusefilter-modify that can see and
change private filters.

Bug: T143365
Change-Id: I401effc5f1e429b5ec12c7f48dcc00ada74eafb6
2016-08-18 16:08:58 -07:00
jenkins-bot 67572c6071 Merge "Allow users with 'abusefilter-view-private' to view history/diff of private filters" 2016-08-11 01:43:41 +00:00
Glaisher 71b48cb28b Invalidate global abuse filter rules from cache when a previously global filter is edited
Bug: T142566
Change-Id: I3604b7eae21d5c50da4cbafe4abb15f4427eef15
2016-08-10 22:05:27 +05:00
jenkins-bot 8ad3a44145 Merge "Remove mention of generateDiffBody()" 2016-08-02 00:19:28 +00:00
Timo Tijhof e02915161c Remove mention of generateDiffBody()
This method was removed from MediaWiki in c35d1ce2.

Change-Id: Ifefb029e22160023217aeab615ccc6542521e68e
2016-08-01 13:43:25 -07:00
Glaisher d043933791 Allow users with 'abusefilter-view-private' to view history/diff of private filters
These pages are read only pages so it's better to let users with
'abusefilter-view-private' to view history and diff of private filters
as 'abusefilter-modify' is a read+write right.

Bug: T126129
Change-Id: I9e15326c8d681000ab13ef8a50fa0eed4c24dbe6
2016-07-25 10:19:06 +00:00
jenkins-bot 9bc9f058f2 Merge "Add GENDER to abusefilter-revert-preview-item" 2016-06-25 15:31:41 +00:00
Gergő Tisza 6a2627e944 Change some globals to work better with extension registration
Rename $wgAbuseFilterAvailableActions / $wgAbuseFilterRestrictedActions
to $wgAbuseFilterActions / $wgAbuseFilterRestrictions and make
them an associative array instead of a plain one, as that works more
sanely with extension registration. (The renaming helps to give more
useful errors to sites using the old config.)

Change-Id: I790d39c2849922d7daf7479f298cd90cf30af129
2016-06-06 19:53:53 +00:00
matejsuchanek 9f097e59db Add GENDER to abusefilter-revert-preview-item
Change-Id: I4fe0190238fc97409c18678a617a8f6a46d41bab
2016-06-04 15:07:40 +02:00
Aaron Schulz f7367dc970 Avoid master queries on page views in loadFilterData()
Bug: T92357
Change-Id: Ib7928067bc0b7ebd631d8abc96e3c24f81e78414
2016-04-28 13:56:41 -07:00
jenkins-bot c8a1e9fa49 Merge "Convert Special:AbuseFilter/import to HTMLForm" 2016-04-18 18:22:55 +00:00
jenkins-bot f4522444c4 Merge "Convert Special:AbuseFilter/history to HTMLForm" 2016-04-18 18:22:52 +00:00
tonythomas01 53b377a6d3 Convert Special:AbuseFilter/import to HTMLForm
Bug: T132284
Change-Id: Ife1ed3af19a4b4b506948763e4d92efc3a14a5bf
2016-04-18 23:07:31 +05:30
jenkins-bot 30534924c4 Merge "Convert Special:AbuseFilter/examine to HTMLForm" 2016-04-18 17:25:23 +00:00
tonythomas01 b21d6a22b1 Convert Special:AbuseFilter/examine to HTMLForm
Bug: T132284
Change-Id: Ie8bc13fd8602d94f53e574efb00f9908f0029ffd
2016-04-17 13:44:04 +05:30
tonythomas01 3b6ca98c6e Convert Special:AbuseFilter/history to HTMLForm
Bug: T132284
Change-Id: I14b98e92fa9e5ad2401c046bbaacd4a98daa5cc0
2016-04-17 10:57:08 +05:30
Aaron Schulz 43a538fe03 Fixes to filter profiling
* Defer the slow profiling updates to post-send
* Convert to the object stash, so that all DCs see
  the same values

Change-Id: I08316c6a3192bd69248cf5ab5a3ed8185341c313
2016-04-13 23:21:32 +02:00
Bartosz Dziewoński 337cad30d9 Add $wgAbuseFilterProfile to enable filter profiling
Follow-up to b60829a60c.

I'll fix up message translations on Translatewiki when this is merged.

Bug: T132189
Change-Id: I1ecaedd7489b264ed621309b6fbfb63b9287a437
2016-04-08 16:53:45 +00:00
Bartosz Dziewoński 39261ff5cd Revert "Removed filter profiling using $wgMemc"
This reverts commit afb78deb84.

I'll guard this behind a global and fix up the localisation messages
in a separate commit. This is a straight revert.

Bug: T132189
Change-Id: Iff4aa6d7d543db8f47c5f81f3c206dafcd5373dc
2016-04-08 16:53:34 +00:00
Bartosz Dziewoński 6298c91bde Remove executable bit from files
find . -perm /111 -type f | grep -v .git | xargs chmod ago-x

Change-Id: I1e5994ba0a74eafdeff262017f90d4c0f09f3ab4
2016-04-08 14:00:52 +00:00
Bartosz Dziewoński d2f7f86160 AbuseFilterViewEdit: Correctly reject non-existent historical versions
Return value of this function is already being checked for this.

Bug: T125572
Change-Id: I6f1d77d335a7ed269e6fbb9aaf2c3a7a566ae992
2016-04-03 00:11:29 +02:00
Glaisher ffcb4d945d Migrate (un)block logging to new system
Also
* Fix a bug where action-reverts doesn't work for anons
since the userid is always 0 for them, instead use the username.
* Start adding block log flags consistently with core

Bug: T124789
Change-Id: Ic6680dad891e2169b392fcfefc1e313af85bc92f
2016-03-21 15:26:59 +05:00
Matthias Mullie 8a9fccbcc8 Fix for tinyint(1)'s not accepting ''
These boolean values go through DatabaseBase::makeList,
which passes them along to DatabaseBase::addQuotes, which
shoves the value through DatabaseMysqlBase::strencode,
which in turn passes it on to DatabaseMysqli::mysqlRealEscapeString,
which eventually calls mysqli::real_escape_string on it.

This last one will turn trues into '1' and falses into ''.
MySQL (or at least my version, 5.6.17 Homebrew) complains about
receiving incorrect integer value '' for these tinyint(1) columns.

Bug: T67807
Change-Id: Iaef98c08589370f9288c1f3c80803b1a16b2506e
2016-01-29 12:18:53 +00:00
Siebrand Mazeland ce1396aea7 Add support for PHP CodeSniffer checks
Also fix any remaining errors and warnings.

Change-Id: Ie49c6172e6bbf8040e5524d33d2f719e96784745
2016-01-06 09:59:47 -08:00
Aaron Schulz dca2451597 Conversion to using startAtomic/endAtomic
This avoids breaking any outer transactions

Change-Id: Idcafec3b4c69948dbbb05677aaf7f65ed6c21574
2015-10-07 22:54:58 -07:00
Legoktm fe8cdc35ca Revert "Add "Last hit" timestamp column to Special:AbuseFilter list view"
This reverts commit 77d161f65c.

Bug: T106798
Change-Id: I265ae108aecbacfcce808ad21e18be4e0eef750e
2015-07-24 10:11:57 +00:00
glaisher 77d161f65c Add "Last hit" timestamp column to Special:AbuseFilter list view
It'll show the timestamp at which the filter was last triggered.
If there is no hit or if the user does not have the proper permissions,
it'll be blank.

Bug: T93564
Change-Id: I435af5caf457c548fa0737ed226d7f8640ff25d8
2015-07-17 10:40:45 +00:00
Aaron Schulz 9ffa400322 Conversion to using getMainStashInstance()
Bug: T97620
Change-Id: I7fc2c0a42bf295d71b9e0721ab4261290334cdec
2015-06-24 20:18:22 +00:00
Aaron Schulz afb78deb84 Removed filter profiling using $wgMemc
* This is very slow as there can easily be hundreds of filters,
  each doing 6 memcached queries. Xenon flamegraphs show a lot
  of time spent in this method, slowing down editing.

Change-Id: I31e4502bbd45cc284db3cd89eb34ad365c59905b
2015-05-19 08:14:33 -07:00
Aaron Schulz 60d1eebb6b Conversion to using WAN cache
* Also removed some code duplication
* Use getConnectionRef in checkAllFilters so that the
  DB connection can be reused

Bug: T93141
Change-Id: I17c5a976b6c45029cde4ed34ad82d69e365ae8c5
2015-05-12 22:55:05 -07:00
Aaron Schulz d0dc183314 Fixed change tag list purging
* Use ChangeTags::purgeTagCacheAll().
* The prior code did not change that actual tag table and
  in any case did nothing since 878523f6225 due to a key
  rename. This covers the two keys using two AF hooks.

Bug: T91815
Change-Id: I227414cde2e95d4533fdf708579113cd3bf2856a
2015-05-12 11:23:17 -07:00
glaisher a4484168e1 Add help link to mw:Extension:AbuseFilter/Rules from Edit view
Bug: T94328
Change-Id: Ic7f39fd6b407942d4691abc9b4f2ff2841ce21f6
2015-03-29 17:38:53 +05:00
se4598 6d316690a9 add filter option for local rules only on central wiki
only affects filter list on central wiki. You can now select to see
local only, global ones or both filters.

Bug: T78495
Change-Id: Idb37aa4f5c3515e0295b74a43176edd2c62508f8
2015-02-17 09:00:44 +01:00
se4598 b6ff5663ab add missing title-param to abusefilter-log form
without it, you get redirected to the main page (index.php) when
$wgUsePathInfo = false; as no title-parameter is given.

also don't rely on __tostring.

Change-Id: I6b97d61c58b196c95836036219201cff8e2e0657
2015-01-04 07:49:44 +00:00
glaisher 6129d2f500 Add a link to filter id in Special:AbuseFilter/history
Currently, there is no link to the current version of the filter
from the history (unless one clicks on the last timestamp link of
that filter) and that is sub-optimal.

Change-Id: Ibc7fcfab386e687d052878602fa810c5a3590d6c
2014-11-17 22:50:43 +05:00
se4598 30fbaf5012 code cleanup: $warnMsg is always set before
removes wrong typed never used alternative value

Change-Id: Ica747fd0904605f5415d763c8f8e00ac55a79053
2014-10-04 17:16:21 +02:00
helderwiki 3b284d8ef2 Expose variables to JavaScript when viewing details or examining a log
When examining AbuseFilter logs using user scripts, it is convenient to have
access to the variables shown in the table, without having to interact with
the page to get the content of the table cells.

This change introduces the variable wgAbuseFilterVariables on these pages:
* Special:AbuseFilter/examine
* Special:AbuseLog/<logId>

Change-Id: I2cebf141e6c1d26e62ed7e6ba0b5c327694e2ef8
2014-08-07 10:23:54 +00:00
huji edabcbc6aa Separate parameters for the filter ID and localized filter name in AbuseFilter
Bug: 67254
Change-Id: I0343971b8be6984820ddf861a76132c9dd064829
2014-06-28 15:23:43 -04:00