Commit graph

61 commits

Author SHA1 Message Date
Umherirrender 405b1a1b76 Avoid error suppressing
Silencing errors is discouraged

Change-Id: If30fd2ebcfd0e4909ce2987eb7feb8d667379696
2017-05-31 22:11:53 +02:00
Antoine Musso 8e09acc804 TitleBlacklistTest singleton can now be destroyed
The test suite set $wgTitleBlacklistSources with a fixture source of
directories.  Unfortunately when running tests from MediaWiki core the
TitleBlacklist has already been set with empty value and thus setting
the global is a noop.

That later causes a test to fail because the blacklist is emtpy.

Add TitleBlacklistTest::destroySingleton() so a test can reset the
singleton when changing $wgTitleBlacklistSources.

Since that is solely for testing, throw an exception unless we had
MW_PHPUNIT_TEST defined.

Bug: T155980
Change-Id: I99c3185811ed7b2225953fa6960096985e97c4d2
2017-01-23 17:41:03 +01:00
Reedy a647e21654 Replace Article::getContent()
Bug: T145733
Change-Id: I61173d02a6b5633bcf87d21063f600428f478ce1
2016-10-09 00:53:57 +00:00
Kunal Mehta 86889ec684 chmod -x TitleBlacklist.list.php
Change-Id: Ifa7fb3c887328fff4175f923fba67eac1ab7aa95
2016-06-15 18:05:34 -07:00
Aaron Schulz 61dddceb86 Use caching in TitleBlacklist::matches() for existing pages
The unicode normalization always shows up as a sizable chunk of call
stack time in flame graphs.

Change-Id: Iebbe6a90020d756e800ebf7b9b12d39b86190a48
2016-05-26 22:54:34 +00:00
Brad Jorsch 7c75416374 Fix 'localpage' message handling
It looks like the original implementation of this (r28307) was
incorrectly using wfEmptyMsg() so it was checking if the specified
message page had content equal to '<titleblacklist>' rather than
checking whether the message actually being loaded was empty.

Then r64178 changed wfEmptyMessage() such that it was checking if the
'titleblacklist' message was disabled in the user's language, which
caused the behavior here to be even more wrong. Then Ie78fa258 came
along to cement this in place and make this code even more
incomprehensible.

So let's go back to what it was probably originally trying to do: return
the 'localpage' message's content if it's not disabled, or empty string if
it is disabled.

This should also take care of T56193#2068536, which is being triggered
by the attempt to load the message in the user's language.

Bug: T56193
Change-Id: I8fe7f03d68e6854106cc903baf7c14ba4badb7c7
2016-02-27 13:44:35 -05:00
jenkins-bot 8655c0c1b9 Merge "Revert "Avoid checking blacklists in isBlacklisted() for existing titles"" 2015-09-19 05:40:54 +00:00
Aaron Schulz 435179beb7 Revert "Avoid checking blacklists in isBlacklisted() for existing titles"
The tacked-on 'noedit' feature for filters requires such checks.

This reverts commit e85196ea53.

Change-Id: Ic816363cb78fd1691737de244a9bcb236533c2b5
2015-09-18 22:40:04 -07:00
jenkins-bot 09458b3422 Merge "Optimize the order of checks" 2015-09-15 11:55:15 +00:00
Aaron Schulz e85196ea53 Avoid checking blacklists in isBlacklisted() for existing titles
Change-Id: Ie44fcb500d28d7d911cb09c0db0947116345514c
2015-09-14 21:06:44 +00:00
Ori Livneh ec739362dd Optimize the order of checks
The `tboverride` permission is not widely granted, so checking for the user
right before checking whether the title is blacklisted optimizes for the
uncommon case.

Change-Id: Ie6ebdf8b9b87d70ebbf2929a5da325f964464e1d
2015-09-10 16:53:40 -07:00
Alex Monk d372b43a75 Use extension registration, replace constants with some reasonable values, kill i18n shim
Bug: T87982
Change-Id: I9ab045da49179618d7c5558b2b066fba2736ae6e
2015-05-19 17:23:14 +01:00
Aaron Schulz 72cff29754 Conversion to using WAN cache
Bug: T93141
Change-Id: I3394b4709d81f7444ac030484b2def744c326209
2015-04-30 01:31:19 +00:00
Chad Horohoe c6a8c0a41b Remove obvious function-level profiling
Change-Id: I65bac94708f8d2f45b9cfae15c5035d2c6fb6931
2015-02-11 08:42:50 -08:00
Ori Livneh 482b800be9 MWException -> Exception
Change-Id: Ifb0e24aea6232149c4576f469534881f298041b7
2015-01-09 19:09:06 -08:00
csteipp 63ea990de6 Log cache misses of blacklist
Checking if error in permission checking is due to cache poisoning.

Bug: T85428
Change-Id: Ibefabe0fc6ba0cca1a4ec718c5b69842a7c52a6e
2015-01-05 16:40:51 -08:00
Jackmcbarn 29a2de58d2 Don't test against redirect targets
There was never any use-case given for this, nor was there a bug report
about it, and it doesn't seem useful in any way, so remove it. Also, add
comments so that it's obvious when grepping that the messages aren't
unused now.

Change-Id: I80079fb4822fbc4f47df592119b1b1f8a367927c
2014-11-30 18:58:04 +00:00
Jackmcbarn bf188e7af1 Add mw.ext.TitleBlacklist.test
Add lua method mw.ext.TitleBlacklist.test(action, title), which tests
whether a titleblacklist entry is active for a given title and action, and
if so, returns details of the entry.

Change-Id: I4360d1ad4e602d58dabd12b683d338a0e09a2950
2014-01-14 17:06:07 -05:00
Kunal Mehta 6863a39ed9 Optionally integrate with AntiSpoof
Introduces a new "antispoof" parameter. If set, try to normalize
the title using the AntiSpoof extension.

Bug: 53901
Change-Id: I9b3c5f5f5d9eeda65562fd83e21c9c2ba97e5569
2013-11-13 15:30:04 -08:00
Victor Vasiliev 52bab2daed (bug 36939) Introduce a way to limit username filter to certain sources.
* Name all sources and track them inside the entries. This should be
  fully backwards-compatible with previous configuration format,
  since numbers may be a legitimate source names as well.
* Introduce $wgTitleBlacklistUsernameSources as a variable which allows
  to specify which sources may be used for filtering usernames.

Change-Id: Ia2702370c85f317c763e345c8f92cb38e23e4196
2013-02-20 22:54:25 -08:00
Siebrand Mazeland 1f8ccafc94 Remove comment and update docs.
Change-Id: I3e80acedeb008ec8f55c8c4f6d6886ce9ae4dfb3
2012-09-24 02:24:32 -07:00
Siebrand Mazeland 16f32456ad Maintenance for TitleBlacklist extension.
* Use Message class.
* Remove trailing whitespace from 'titlewhitelist'.
* stylize.php.
* Update .gitignore.

Change-Id: Ie78fa25816808b0a695cc20630097326fb4cf705
2012-09-18 15:57:57 +02:00
Sam Reed 028cf69054 Documentation
Swap a lot of "@returns" to "@return"
2011-10-13 18:44:26 +00:00
Tim Starling b0b04747eb Fix for r76344: you can't access $wgUser during the CentralAuthAutoCreate hook, because it's the same object that invoked CentralAuth via UserLoadFromSession, after mLoadedItems is set to true but before any data is initialised. The calling code in CentralAuth does permissions checks correctly, by creating a new User object for the anonymous user who is logging in. That's what I've implemented here too.
Most of the changes here are just propagating the anonymous user object through the call stack.
2011-09-22 06:10:45 +00:00
Sam Reed a851665ab2 <preilly> PHP fatal error in /usr/local/apache/common-local/php-1.18/extensions/TitleBlacklist/TitleBlacklist.list.php line 326:
Fixed in 1.18wmf1 and trunk
2011-09-20 00:11:20 +00:00
Sam Reed 50b14054c7 Tidy up documentation 2011-08-22 20:37:26 +00:00
Alexandre Emsenhuber 661285c2db Added TitleBlacklist::singleton() to get an instance of the TitleBlacklist instead of having to use $wgTitleBlacklist and call efInitTitleBlacklist() 2011-07-30 15:13:28 +00:00
Sam Reed 3121f8e728 Whitespace, braces, documentation 2011-04-12 00:16:04 +00:00
Sam Reed 4ae9c4dfaa Invert match call for whitelist also
Add missing false to return documentation
2011-03-23 16:30:49 +00:00
Sam Reed 939bf7f912 Followup r84575, bug 27470
Inverse all the booleans in matches

Previous fix was naieve, and just ended up picking the first regex and dieing with that
2011-03-22 23:07:21 +00:00
Sam Reed 3f4d451d20 Followup r76344, fix another inversed logic
-			if( !$item->userCan( $title, $wgUser, $action ) ) {
+			if( !$item->matches( $title, $action ) ) {

Fix some trailing whitespace also

Related to bug 27470 and bug 28166
2011-03-22 22:30:23 +00:00
Sam Reed c8d5112717 Documentation, braces, unused globals 2011-03-17 22:20:01 +00:00
Sam Reed 4db154c598 Trim/fix whitespace 2011-03-14 23:44:41 +00:00
Sam Reed d1b3021d6f TitleBlacklist
Fix undefined $user

Documentation, braces
2011-03-14 20:51:13 +00:00
Victor Vasiliev 3219bf6dcb Title blacklist:
* (bug 22141) Introduce a separate user right for overriding title blacklist on account creations only
* Some minor refactorings
2010-11-08 21:55:05 +00:00
Sam Reed ba60d29a9a Another big cull on unused variables and such 2010-10-29 21:55:29 +00:00
Alexandre Emsenhuber c52acec944 Big changes to extensions' documentation:
* changed all @addtogroup to @ingroup
* added some @file where needed
* changed some @package/@subpackage to @ingroup
2010-06-06 15:12:22 +00:00
Alexandre Emsenhuber 650409f2a3 * (bug 18822) Title::newFromString() doesn't exist; changed to Title::newFromText() 2009-05-17 14:12:38 +00:00
Fran Rogers 97a9812b69 Fixes for problems mentioned in r38967 2008-08-09 01:54:39 +00:00
Brion Vibber 1c2794eb00 Revert r38636 and following for now, doesn't work at present.
Aug  8 23:22:25 srv35 httpd[5547]: PHP Fatal error:  Using $this when not in object context in /home/wikipedia/common/php-1.5/extensions/TitleBlacklist/TitleBlacklist.list.php on line 98 

Fatal error: Call to private method TitleBlacklist::parseBlacklist() from context 'TitleBlacklistHooks' in /Library/WebServer/Documents/trunk/extensions/TitleBlacklist/TitleBlacklist.hooks.php on line 90
2008-08-08 23:26:44 +00:00
Aaron Schulz f8bb839af7 this is static 2008-08-08 23:24:19 +00:00
Fran Rogers 129796f76b Added username blacklist capabilities to TitleBlacklist. Since the
UsernameBlacklist extension is unmaintained, rather brittle, and only 
supports a single local blacklist, and also on most wikis both 
blacklists will be closely intertwined if not identical, it seems 
logical that TitleBlacklist take over both functions. :)
2008-08-05 15:57:10 +00:00
Ilmari Karonen d28982948c Disallow angle brackets within options, to avoid breaking regexps which contain '<'. 2008-05-29 20:23:05 +00:00
Ilmari Karonen afac00b084 Remove verifyUpload hook, just check images using the normal userCan hook. This closes a loophole that allowed creation of blacklisted image pages via normal editing. Note that combining this version with MediaWiki revisions prior to r35167 breaks the 'reupload' option and produces uninformative output for blacklisted uploads. 2008-05-22 01:35:48 +00:00
Ilmari Karonen f4ef120e59 Add new option "moveonly" to forbid moves but allow ordinary creation (should be good against pagemove vandalism). 2008-05-21 23:23:24 +00:00
Ilmari Karonen ce6ce05dfa Add non-capturing parentheses to ensure even expressions like "Foo|Bar" get fully anchored. 2008-05-21 23:00:39 +00:00
Bryan Tong Minh b89489091c (bug 13803) Add 'reupload' parameter to allow reuploads of existing blacklisted images. 2008-04-20 21:21:16 +00:00
Victor Vasiliev 2381cc0693 * Use this (see prev commit) hook in the TitleBlacklist
* Fix profiling
2008-01-14 13:52:05 +00:00
Victor Vasiliev b7bc8af616 TitleBlacklist:
* Add title whitelist
* Add profiling
* Make cache version check really work
2008-01-08 18:00:59 +00:00
Brion Vibber f74f0713fd * (bug 12483) Transform '_' to ' ' in blacklist regexes for convenience 2008-01-03 00:58:52 +00:00