Commit graph

233 commits

Author SHA1 Message Date
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
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
Matthias Mullie 2c449c3acc (bug 65805) Fix notice when creating new filter
Notice: Undefined index: af_throttled in
extensions/AbuseFilter/Views/AbuseFilterViewEdit.php on line 148

This assumes af_throttled to exist in $newRow, which comes
from AbuseFilterViewEdit::loadRequest, which in turn comes
from AbuseFilterViewEdit::loadFilterData, where no
af_throttled property is added to the newly created object.

Bug: 65805
Change-Id: I45ad0ea2cea242711b6109e67b99b71242ff57f6
2014-05-27 15:26:17 +02:00
Kunal Mehta 4deb2cc1be Use FormatJson instead of json_* functions
Change-Id: Ic4eccb13429d4081153b5deb550ac33bf2bd687d
2014-02-27 08:38:07 -08:00
addshore 28ad8fa659 Remove random space in AbuseFilterViewTestBatch
Change-Id: I2c95e09d7e34ed1d517114324b2ad988ad659dfb
2014-01-25 14:04:18 +01:00
tonythomas01 068c3c54c3 Increased the number of rows in AbuseFilter's Filter testing textarea
Changed the textarea size in AbuseFilter Notes text area
from 5 to 15 to match with the new Conditions text box.

Bug: 55365
Change-Id: I1da26166f28f31b2a18c1dca3709efc0728d45d6
2014-01-25 00:42:05 +05:30
Chad Horohoe f38a00336d Don't even mention $wgTitle in comments
Change-Id: I28c8c4cb31e7beafcc3bca2620c3e65d8853ad51
2014-01-22 20:47:06 -08:00
jenkins-bot 90b18774fc Merge "Prevent fatal error in Special:AbuseFilter/test" 2014-01-15 00:18:49 +00:00
tonythomas01 c5dea20d99 Used [[MediaWiki:Parentheses]] instead of hardcoded parentheses
Corrected $s .= " ($examineLink)";
Corrected Wrong code
Added the ' ' before parantheses
Corrected spell error

Bug: 50796
Change-Id: I50a0b93a86101e6556045d91d03a4784deacaaea
2014-01-12 19:59:41 +05:30
Jackmcbarn 4255e3810b Prevent fatal error in Special:AbuseFilter/test
When an invalid page name is entered in Special:AbuseFilter/test, display
a sane error message rather than throwing a PHP fatal error.

Bug: 55411
Change-Id: I5ec005180c9009f6d14244f3b03221e525cfaed3
2014-01-04 15:28:37 -05:00
Kunal Mehta e7f8acf709 Replace usage of SpecialPage::getTitle with getPageTitle
Was deprecated in 1.23, see Icdcf5d5295ef5e7f08b1d403e0c123f78738fd40

Change-Id: I67701856297927b94aa443a78376bae7d7860def
2013-12-26 22:36:34 -08:00
Reedy 6204b76512 Fix Call to undefined method TableDiffFormatterFullContext::_start_diff()
Bug: 57268
Change-Id: I3bf5f6690530a89f25b1716406a92524d07c4c2b
2013-11-19 20:09:32 +00:00
Siebrand Mazeland b384fe8d8f Declare class properties, update docs
Based on static code analysis.

Change-Id: Ibafe33b6327ab72429ba961079af40039fb41cbf
2013-11-06 16:12:37 +00:00
Siebrand Mazeland 2bb441ee9c Declare visibility on class properties
Also compress some variable documentation.

Change-Id: I47d31e18df18492373aa407ea19f1a81b2cf5d57
2013-11-06 16:11:09 +00:00
Siebrand Mazeland ddc930e897 Ensure variables are defined
Change-Id: Iab1d36b0162c1d7a91cdd80ac36bbf338e7df61d
2013-11-06 17:09:24 +01:00
jenkins-bot 14871447ee Merge "Adding some comments to explain what various classes are for." 2013-11-05 13:26:15 +00:00
kaldari 307b078ada Only allow throttling if object caching is enabled...
...otherwise it doesn't work.

This change add 2 checks for object caching, one for the filter
configuration interface, and one for the actual throttle checking.

Bug: 50894
Change-Id: I89ebcc6ff7d91d3a9ad8e744c0c4ff3e33e3b673
2013-10-31 14:59:26 -07:00
kaldari b165827b67 Adding some comments to explain what various classes are for.
Change-Id: Ic44342035bc277dfd75c1da06a3a1205e8c659a4
2013-10-24 15:11:08 -07:00
jenkins-bot 1c439d0002 Merge "Add missing parameters to message call" 2013-10-21 17:19:16 +00:00
Simon Walker 3612f45b2b Remove trailing whitespace
Change-Id: I1d9c4e64d09eeb9470d85476e030a1590495fa52
2013-10-07 18:08:11 +01:00
Simon Walker 938d101711 Add links to abusefilter-edit-done
This adds a link to the diff of the edited filter, and a link to the filter
itself.

Bug: 52590
Change-Id: If741756ef398a61ae0fcd809eaee5a040ac8ca3d
2013-10-07 13:17:07 +01:00
Marius Hoch 5ed5230a49 Refactor AbuseFilterView::canEdit* functions
Don't use global state in here, centralize
the logic for global filters and avoid static
functions.

This also makes the UI for global filters nicer
in case the user can't edit them (as all fields
are disabled then).

Change-Id: Ica4e77536d315d8ef39a45666c6b8834315bee77
2013-08-26 19:57:00 +00:00