Commit graph

367 commits

Author SHA1 Message Date
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Siebrand Mazeland
475a1daa03 Replace some occurrences of wfMsg* by alternatives. Undeprecated wfMsgReplaceArgs.
* wfMsgReplaceArgs isn't really i18n related. It just replaces text parts.
* Updated language.txt. Now refers to mediawiki.org.
* Removed deprecated Block::formatExpiry(). Merge Id7d057a4 first.
* Reformatted weirdly formatted array in ApiBase.php.
* Removed wfMsg() in RandomTest.php.

Change-Id: Ied5cfda8fa5d9283dfeebdcb0e1af8453d47e7a9
2012-09-03 11:49:58 +02:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Antoine Musso
281510195d remove windows lines ending
Introduced by commit 6c2cf98
https://gerrit.wikimedia.org/r/8919

Change-Id: Idfe6dd1f6d2b7fabfdbccd9acf6f0dcbbb5833be
2012-05-27 21:40:19 +02:00
umherirrender
6c2cf98e3d Block.php: replace '*' with explicit fields in selects
It is good practice to select only fields, which are used later

Change-Id: I50d149b3ecd3a9e0325fecbe8d0b6e1fff353893
2012-05-25 16:50:57 +02:00
Demon
b095e93a1a Merge "Use the same object when checking if the user is blocked instead of creating a new one." 2012-05-04 14:09:05 +00:00
Marc A. Pelletier
7694faf68f (bug 5445) remove autoblocks when user is unblocked
Previously, whenever we blocked a user, its IP address would be
autoblocked whenever he tries to edit a page. Thus when later unblocking
the username, he would be automatically blocked again if we forgot to
clean up is IP.

This patch introduces a the ipb_parent_block_id column in ipblocks table
to track which block triggered the autoblock command. Thus, when deleting
the original block we can easily remove all subsequentautoblocks.

Schema updaters for MySQL, SQLite and postgres have been added to the
patch but not for the other database types such as ibm_db2, mssql and
Oracle.

Change-Id: I4aa820ae9bbd962a12d0b48b6c638a1b6ff4efc9
2012-05-03 12:07:30 +02:00
Alexandre Emsenhuber
89df167b20 Use the same object when checking if the user is blocked instead of creating a new one.
* Block::parseTarget() first called trim() on its parameter which was converting objects into string, thus making the checks for object and null useless; now trim() is called after these checks.
* User::getBlockedStatus() was passing $this->getName() to Block::newFromTargert() which in turn was passed to Block::parseTarget() where a new User object was created.
  Instead of this, the User object is directly passed to Block::newFromTargert(), which avoids creating a new object for the same user.

Change-Id: Iffea21d4f53e8692072749264f7486c22b6be5fd
2012-04-17 09:48:58 +02:00
Aaron Schulz
e82c2cc7ee Merged r114672 from wmf1.19 plus tests; crosswiki block name/id fix.
Change 1:
* Delete any pre-existing block for the tests
* Renamed test function and fixed comment typo

Change-Id: I4804ccae81dd0455e9d3ddf48960c4b5cd6e4f5f
2012-04-10 09:49:52 -07:00
Aaron Schulz
7377efa7de Force the target user ID to be the correct foreign ID on the relevant local wikis for crosswiki suppress blocks. 2012-02-28 02:04:30 +00:00
Sam Reed
e1d83d5721 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 18:01:54 +00:00
Sam Reed
85ee2d2db2 * (bug 33101) Viewing a User or User talk of username resembling IP ending with .xxx causes Internal error
Patch by Brad Jorsch

Also simplify double return null in method
2011-12-15 18:57:53 +00:00
Jeroen De Dauw
49cdca93be add missing deprecation notices and added deprecation version to existing ones 2011-12-13 05:19:05 +00:00
Sam Reed
ec9afed7ce Add a getExpiry method to Block (rather than direct member variable access. Yuck) 2011-12-06 15:23:21 +00:00
Jure Kajzer
69e66bdfe9 * reverted changes to Block and ApiBlockTest made in r102625 ... PEBKAC 2011-11-10 09:36:18 +00:00
Jure Kajzer
be3bbfc539 * Added getInfinity to DatabaseOracle
* Block - replaced 'infinity' strings with DB->getInfinity calls
* UploadStash - added sequence value generation for ID
2011-11-10 07:41:12 +00:00
Jure Kajzer
d9b00fc155 * fixed ipblocks.ipb_by_text field, removed default blank not null (fixed install&update)
* fixed Block->insert; ipblocks.ipb_id is autoincrement field (should use sequences for compatibility)
2011-11-04 11:35:10 +00:00
Aaron Schulz
7916d730ae (bug 31739) Made Block code support ipb_by = 0 convention with for foreign users again, as it did pre 1.18. The byText param has been restored in the Block() constructor as CentralAuth still uses it. Some callers have been updated to reflect the fact that getBlocker() may be a local User or a string username.
Ideally, we might have a ForeignUser class and a generic User interface...but this will do for now.
2011-11-01 00:11:53 +00:00
Sam Reed
9d41b95053 Kill various unused variables
Comment some out also

Add some bits of documentation
2011-10-29 01:17:26 +00:00
Sam Reed
27665d27ae Update some deprecated code
Documentation

Fix "/*" comments to "/**"

Flesh out some missing returns, change some return types
2011-10-14 21:18:38 +00:00
Robin Pepermans
894bdaabe4 Fix r91886 thanks to johnduhart: check if it is an IP *before* stripping subpages, otherwise IP range blocking does not work 2011-08-12 14:32:05 +00:00
Rotem Liss
1d2e8d29ef Fixing comment (no Language::decodeExpiry). 2011-08-02 11:47:36 +00:00
Sam Reed
fcebee405f Add comment
Remove unused wfGetDb()
2011-07-18 22:23:42 +00:00
Andrew Garrett
4b12070e70 Fix autoblocks in r92480 r92482 -- modified the wrong half 2011-07-18 22:02:11 +00:00
Andrew Garrett
db9832ae98 Fix autoblocks in r92480 2011-07-18 21:56:59 +00:00
Andrew Garrett
365bf2cfc3 Block.php fixes: Always store mExpiry as a TS_MW or "infinity". Convert as appropriate. 2011-07-18 21:48:56 +00:00
Aaron Schulz
4a1b848c58 Follow-up r92220: changed autoblock handling to use PerformRetroactiveAutoblock hook instead of a global. Also made CheckUser always override autoblocks (no config). 2011-07-15 00:48:02 +00:00
Aaron Schulz
02af8ad230 * Removed angry autoblock code - unused by anything
* Added $wgAutoblockHandlers variable for alternative autoblock handling functions
* Gave CheckUser a potential $wgAutoblockHandlers function (bug 29330)
2011-07-15 00:05:50 +00:00
Robin Pepermans
740b9aa49f (bug 29797) Error: "Tried to load block with invalid type" when subpages are disabled for user pages.
Patch by Jarry1250
2011-07-11 16:53:31 +00:00
Happy-melon
b99ab08b2a Follow-up r88738: this check is no longer needed since r88750. 2011-06-27 13:48:01 +00:00
Happy-melon
89b9bc984d Follow-up r84588 CR 2011-06-26 23:10:57 +00:00
Happy-melon
f26f0a13ae Follow-up r84475 CR; and also documentation fixes; PhpStorm 2.1 is *even more* fussy about documentation format... :D 2011-06-26 23:01:29 +00:00
Siebrand Mazeland
7779b72373 Reduce calls to wfTimestampNow() by using temporary variable. Inspired by CR on r88278. 2011-06-24 10:00:35 +00:00
Aaron Schulz
66894363d8 Tweaked comments and code in confusing spot of doAutoblock() 2011-06-18 00:29:32 +00:00
Brion Vibber
6286ac2971 Another partial fix for Block test: update $this->mId on successful Block::insert() 2011-06-15 20:42:16 +00:00
Brion Vibber
39259a36ec Fix for partial regression in r84534: Block::newFromId was no longer handling the case where there was no matching row correctly. Now returns null.
This bug was showing up in test results like this:

  BlockTest::testInitializerFunctionsReturnCorrectBlock
  Trying to get property of non-object
  
  /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/includes/Block.php:340
  /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/includes/Block.php:365
  /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/includes/Block.php:118
  /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/BlockTest.php:60
  /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
  /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
  /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60

However, that only triggers because the actual test is failing -- it's expecting to get a return back. This can only be reproduce when using the suite.xml configuration file, and not when running the BlockTest standalone.
2011-06-15 19:05:25 +00:00
Chad Horohoe
e1d01b4d7b Fix (Api)BlockTest for Sqlite. getRangeStart()/getRangeEnd() were returning null for user blocks, which was then happily inserted into a NOT NULL column. The IGNORE was just masking the real error. Thanks Brion and MaxSem. Oh, and ping r84475 2011-06-07 18:13:21 +00:00
Mark A. Hershberger
a6722cc9aa w/s changes. 2011-06-02 19:32:45 +00:00
Sam Reed
4065e65d03 Even more documentation in various files 2011-05-29 14:24:27 +00:00
Sam Reed
2b676156ba And even more documentation 2011-05-28 18:58:51 +00:00
Brion Vibber
536fad8f90 * (bug 29116) Fix regression breaking CheckUser extension
Fixes regression from r84475 and friends which made Block->load() and its new front-end Block::newFromTarget() fail when an empty string was passed in as the IP / $vagueTarget parameter to indicate skipping IP-based lookups.
Added phpunit test cases to confirm that both Block->load() and Block::newFromTarget() work when given null (already ok), '' (as done from CheckUser), or false (not seen, but perfectly legit sounding).
Adjusted comparisons to work as expected.
2011-05-24 21:04:50 +00:00
Happy-melon
28105675da (bug 29116) follow-up r84475: normalise the empty string to null in Block::newFromTarget(). 2011-05-24 19:03:41 +00:00
Happy-melon
d91b0ed998 Follow-up r84475: Block::parseTarget() should always return an array. 2011-05-23 18:52:36 +00:00
Alexandre Emsenhuber
9536c97c00 DB_READ -> DB_SLAVE, the former is obsolete 2011-05-18 19:29:50 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Sam Reed
1d5b18a1a2 Revert r85776, r85782 pending better solution 2011-04-12 20:27:26 +00:00
Sam Reed
89a136bb46 Followup r85776, per Aaron, add documentation showing reason why explicit creation of a new LB was added 2011-04-11 12:48:59 +00:00
Sam Reed
0966401501 * (bug 28485) Block::purgeExpired Database returned error "1205: Lock wait timeout exceeded;"
Commit changes per Tims suggestion on the ubg
2011-04-11 00:29:42 +00:00
Paul Copperman
f7e6dfb4a3 Various fixes for PHPUnit tests:
* Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock.
* In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock().
* ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock().
* ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename	to account for customizations.
* RandomImageGenerator.php: Use default value for constructor param to prevent fatals.
* ApiTestCaseUpload.php: 
** Fix undefined variable $fileName.
** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track.
* ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868.
2011-04-07 14:54:38 +00:00
Platonides
b37e81b76b Use class name Html in canonical form.
Removed unused globals $wgHooks, $wgBlockAllowsUTEdit, $wgUser, $wgOut
$wgUser was already set global at function beginning.
Moved global out of switch
2011-03-24 21:35:14 +00:00
Happy-melon
12a29249ae Try to untangle the autoblock time logic, which made very little sense and led to very old indefinite blocks triggering autoblocks with ipb_expiry < ipb_timestamp. 2011-03-23 00:10:46 +00:00
Happy-melon
40a926ab2c (hopefully) last bit of heavy lifting in Block.php: now that we've internalised most of the variables, untangle their twisted connections to the database layer and remove various now-unused protected methods and variables. 2011-03-22 17:18:15 +00:00
Aaron Schulz
f6e0bc9324 Fixed daft error in r84523 so "angry" autoblocks work again 2011-03-22 11:51:09 +00:00
Happy-melon
a9016c40ff Don't try and load a block with no target; we're not going to find it :D 2011-03-22 11:45:18 +00:00
Aaron Schulz
bc6ec5e2ff Relate block log entries to block table rows (useful for bug 25763) 2011-03-22 11:22:15 +00:00
Happy-melon
271062e07e Follow-up r84475: what ever posessed me to get rid of this? 2011-03-21 23:27:08 +00:00
Happy-melon
cf08b61b1b Follow-up r84475: fixing the warning is easy enough... :D Also some random tweaks to Database.php documentation. 2011-03-21 23:03:11 +00:00
Happy-melon
6dbcdc1be0 Blame hashar for this giant commit; he teased me for making so many smaller ones earlier... :D
* Internalise $mAddress/$mUser, $mBy/$mByName, $mEnableAutoblock, $mId as getTarget(), getBlockers(), isAutoblocking(), getId().  
* This required editing AbuseFilter and CheckUser backwards-incompatibly, so push the rest of the changes out to those extensions.
* Attack the evil 14-parameter constructor and gratuitously-confusing newFromDB( $notVeryImportantParameter, $moreImportantParameter)
* Reimplement the hack for bug 13611 in a slightly less fragile fashion; could still do with further cleanup, but then again the login frontend is its own can of worms... :S
* Remove transitionary getTargetAndType() and newFromTargetAndType() methods
* Some optimisation in parseTarget()
* Fix the broken phpunit test mentioned in r84251
2011-03-21 19:12:41 +00:00
Happy-melon
b61f104042 Follow-up r84358 CR: rename 'editusertalk' to 'editownusertalk', private --> protected, and run stylize.php over Block.php 2011-03-20 17:43:17 +00:00
Happy-melon
7eac649e6d * Implement an extensible Block::prevents( <action> ) function to replace the plethora of direct member variable accesses This pushes the historic *disable*-createaccount-vs-*allow* usertalk-edit wierdness down to the database layer
* Implement accessors for isHardblock() and getRangeStart()/getRangeEnd() in the same fashion.
* Make the corresponding variables private, removing external accessors.  This required updating AbuseFilter with non-B/C code, so I also implemented the rest of the changes I've made to the blocking backend in that extension.
* Move the "get an IP range which encompasses the given IP/range" logic to Block.php; will be needed later... :D
2011-03-19 23:47:08 +00:00
Happy-melon
d1223c41bb Mark various internal methods as protected, which have no external calls in core or extensions. 2011-03-19 17:44:01 +00:00
Happy-melon
408181b29e Follow-up r84336: break some long lines 2011-03-19 17:36:10 +00:00
Happy-melon
f1b1aafa1d Block::forUpdate() is never called, and doesn't really make much sense in this context anyway; remove it and simplify. 2011-03-19 17:32:59 +00:00
Happy-melon
04e5a7daa3 Clarify the behaviour of Block::parseTarget(), and that TYPE_AUTO and TYPE_ID are broadly the same. 2011-03-19 16:50:21 +00:00
Happy-melon
3e89cb5506 Remove some insanely ancient (~r4797) unused globals and variables, and make private variables actually private (no external calls to worry about) 2011-03-19 16:41:14 +00:00
Happy-melon
99f39a4779 Move Block::normaliseRange() to IP.php, then reduce it to 4 lines by using the existing functionality in that class. 2011-03-18 23:28:23 +00:00
Happy-melon
21fcf991d0 Follow-ups to r84258 2011-03-18 22:28:39 +00:00
Happy-melon
91e7b5a93c More cleanup in Block.php. Push Block::encodeExpiry() and Block::decodeExpiry() deeper into the callstack, to DatabaseBase for encode and Language for decode. The vast majority of callers of these functions are not handling block expiries, but expiries generally, particularly page protections. 2011-03-18 19:15:56 +00:00
Happy-melon
ad0e525ede First forays into the swamp of the Block.php backend:
* Move Block::parseExpiryInput() to the frontend SpecialBlock::parseExpiryInput()
* consolidate the several implementations of the MediaWiki:Ipblockoptions parsing into SpecialBlock::getSuggestedDurations()
2011-03-18 16:35:22 +00:00
Happy-melon
0a8a3b452c Further massive rewrite of the blocking frontend: spin out unblocking into a new SpecialUnblock.php. This leaves IPBlockList as, astonishingly enough, a list of blocks... :D 2011-03-13 21:33:52 +00:00
Happy-melon
995d7bb5ea Follow-up r83827: a Block object will never be internally of TYPE_ID. 2011-03-13 15:44:49 +00:00
Happy-melon
bb6644de69 Follow-up r83825: fix Block::parseTarget to recognise autoblocks separately, and change Block::getRedactedName() to run the string through a system message for localisation 2011-03-13 15:14:33 +00:00
Happy-melon
f64f960d9a Some refactoring in Block.php and SpecialBlock.php: move backend stuff into Block.php, and expand the parseTargetAndType() functions to recognise blocks referenced by their block id. 2011-03-13 14:47:34 +00:00
Happy-melon
7805997608 Divert a river through the Augean Stables that is SpecialBlockip.php.
* Move to SpecialBlock.php, and rename class appropriately
* Complete refactor
* Use HTMLForm in block form.  This changes most of the ids and field names on the form, but allows proper validation, nicer formatting, clears up several fixmes, and is generally Better(TM).
* Spin various parts out into static functions, several of which properly belong in the backend (but Block.php is a worse mess still)
* Invert some of the block options so that every checkbox makes the block more severe (so "check to disable email" is fine, but "check to allow usertalk edit" (default true) is inverted to "check to disable usertalk edit" (default false). 
* revert r40359 (move doMassUserBlock() to core).  No one seems to be using this function, which has nothing to do with the frontend UI in SpecialBlock (it might perhaps belong in Block.php); it is pretty bespoke for CheckUser, doesn't seem to have very much utility elsewhere.
2011-03-12 21:54:35 +00:00
Chad Horohoe
b61756cdea Followup r73348, r70608: move 'infinity' stuff to DB classes 2011-01-05 13:43:13 +00:00
Brian Wolff
2b1a4c92d4 (Bug 26425) Due to r71751, wfTimestamp stopped accepting '' to mean get
current timestamp. This caused Block::__construct to put all sort of 
messages in the debug log about invalid timestamp. So change Block to use
timestamp of 0 instead of '' if unspecified.
2010-12-26 04:38:41 +00:00
Aaron Schulz
8648b3cdca Fixed r76560: one more caller of now-private toUnsigned6 2010-12-08 22:18:43 +00:00
Roan Kattouw
11c67c2d6d Fix indentation in Block::infinity() 2010-11-25 15:12:04 +00:00
Sam Reed
a2589ff8c6 Assignment in loop conditions suck
while ( $row = $dbw->fetchObject( $res ) ) { to foreach ( $res as $row ) in includes

Add some braces
2010-10-13 23:11:40 +00:00
Chad Horohoe
7d3bd14822 Followup r70608, don't use master connection just for type check, and use getType() instead of instanceof 2010-09-19 23:25:57 +00:00
Ryan Bies
070122e8b9 DatabaseMssql class and related changes 2010-08-06 23:44:00 +00:00
Alexandre Emsenhuber
4b507edd85 removed PHP4-ism 2010-07-11 18:13:23 +00:00
Alexandre Emsenhuber
fa537d2d3f Fixed some doxygen warnings 2010-06-15 20:09:19 +00:00
Siebrand Mazeland
d279df340e Ran stylize.php, removed trailing whitespace, updated indentation and code formatting. 2010-05-30 14:48:30 +00:00
Platonides
2eea87df8a Stylize. 2010-04-17 21:16:06 +00:00
Platonides
839001c7cc Add yet another parameter for Block construction, so this doesn't show runJobs.php blocking anyone when run from the job queue :)
Follow up r65184.
2010-04-17 21:06:21 +00:00
Platonides
38e64983a2 Follow up r64982. Autoblocks aren't automatically set just by storing ipb_enable_autoblock, we need to look for them.
So do this properly and use Block class to insert the block.
2010-04-17 20:59:05 +00:00
Max Semenik
5d543aeae8 Fix bug that prevented non-hidden users from appearing on Special:BlockList on SQLite 2010-03-12 19:18:14 +00:00
Alexandre Emsenhuber
a5ebe1f736 * (bugs 22665 and 22667) User '0' can now be unblocked and have its block settings changed 2010-02-27 16:15:41 +00:00
Siebrand Mazeland
f8b1c4cfb7 Random indentation and code formatting updates. No functional changes. 2010-02-14 22:07:30 +00:00
Jure Kajzer
785ad24aa7 Changed sequence names to a standard <table>_<field>_seq form.
Updated all nextSequenceValue calls with new sequence names.
OverlordQ stated he'll handle changes to Postgres scripts.
Need someone to change DB2 scripts.
2009-10-28 16:17:16 +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
Jack Phoenix
092597b8e3 coding style tweaks 2009-10-19 11:15:51 +00:00
Siebrand Mazeland
5a40128656 (bug 17093) Separate date and time in Special:BlockList 2009-05-25 18:02:58 +00:00
Niklas Laxström
d3b61fea7c Escaping fixes 2009-05-22 09:35:48 +00:00
Alex Z
d6ba719217 (bug 18860) Allow non-anon-only blocks of IPs to block email 2009-05-21 20:32:28 +00:00
Niklas Laxström
6b05fb6133 * Allow changing block reason 2009-02-21 10:15:10 +00:00
Alex Z
6779a2cc13 adding newline to end of wfDebug calls where it was missing. 2009-01-13 20:28:54 +00:00
Andrew Garrett
abde25fc39 Do initialiseRange into Block::insert.
Fix related fatal in Abuse Filter.
2008-12-15 12:10:41 +00:00
Alexandre Emsenhuber
7b3b006f94 fix doxygen warnings 2008-12-09 19:54:30 +00:00
Aaron Schulz
1ead2ea8b6 *Remove unused functions
*Mark visibility
2008-11-30 13:09:19 +00:00
Aaron Schulz
1176cd5ad0 * I didn't even notice the extra reblock check; merged this into submit button with hidden input.
* Break long line
* (bug 16436) Don't log if nothing changed
2008-11-23 09:52:29 +00:00
Alex Z
ddfab2390f (bug 15789) Autoblocks now have the same setting for editing user talk as the original block. 2008-09-30 19:57:00 +00:00
Matt Johnston
08e561abb9 (bug 8440) Allow preventing blocked users from editing their talk pages
* Adds database field to ipblocks table, ipb_allow_usertalk, storing whether or not the user can edit their own talk page. Defaults to 0 to coincide with the default value of $wgBlockAllowsUTEdit.
* Recommended to update all current blocks to have a allow_usertalk value of whatever the current setting is
* Retasks $wgBlockAllowsUTEdit to be the default value of the field in the blocking screen - unless a sysop changes the checkbox, will use whatever that variable is set to.
2008-09-25 11:45:26 +00:00
Tim Starling
6f6d09b0e4 Fix docs for r41150, remove commented-out code, remove superfluous brackets in "new" expressions. 2008-09-24 08:46:18 +00:00
Aaron Schulz
926cf89eb1 Add comment 2008-09-22 13:33:06 +00:00
Aaron Schulz
9f5955b76b Apply account creation blocks to users (bug 13611) 2008-09-22 13:21:53 +00:00
Tim Starling
654ec70c23 * Fix some documentation
* Fix K&R style braces, since demon started, we may as well finish. This was one of the last files I wrote before I was converted to Brion-style braces.
* Renamed a variable
2008-09-22 04:52:51 +00:00
Alexandre Emsenhuber
c8113ad020 Fatal error: Call to undefined function wfMemc() in includes/Block.php on line 550 2008-09-21 20:25:21 +00:00
Chad Horohoe
29b0c85cb2 More block updates:
* Improve docs (formatExpiry() is fine, abstracting wouldn't do anything, as it would just become a wrapper for $wgLang->timeanddate())
* Abstract out some param validation from insert()
* Add an update() method to make modification of existing blocks a bit nicer.
2008-09-21 15:16:32 +00:00
Chad Horohoe
561baaedc7 Helps to actually _put_ the info into $wgMemc... 2008-09-21 14:25:46 +00:00
Chad Horohoe
5d66ee3650 * Lots and lots of docs
* Cache the autoblock whitelist in $wgMemc
* Remove old commented out code from when 'infinity' wasn't really 'infinity' but just really far in the future
2008-09-21 14:22:23 +00:00
Andrew Garrett
7106853462 Refactor out Block::isWhitelistedFromAutoblocks 2008-08-08 05:56:43 +00:00
Andrew Garrett
f788268ce2 Don't be lazy: Initialise autoblock objects with both the blocker ID and their name 2008-06-27 09:22:12 +00:00
Andrew Garrett
171c47e0a2 Core changes for AbuseFilter extension.
In particular:
Xml.php
* Add textarea method to Xml class.
* Make submit button optional for Xml::buildForm
* Right-align labels in buildForm.

Article.php:
* Make ArticleDelete hook display a real error

EditPage.php:
* Split off getBaseRevision()

Title.php:
* Allow errors to be ignored to be sent to getUserPermissionsErrors.
* Allow AbortMove hook to display a real error.

Block.php:
* Add 'mAngryAutoblock' option, for blocks by software, which does retroactive autoblocks on the last 5 IPs used in the last 7 days.
2008-06-27 06:24:42 +00:00
Brion Vibber
7b0abe4335 drop redundant wfTimestamp() call... we already got it formatted in TS_MW from decodeExpiry() 2008-05-23 20:31:41 +00:00
Andrew Garrett
bc23aede55 Core changes for GlobalBlocking and TorBlock extensions, plus some core refactoring work:
* Instead of saying 'do that' in a permissions error, actually list what the action is (drawn from the right-$1 messages). This isn't perfect - it says you don't have permission to edit pages when 
you can't edit a single page, but it's better than 'do that'.
* Refactor out some code from various block files into Block::formatExpiry and Block::parseExpiryInput.
* Don't display 'you cannot edit special pages' when you're trying to execute, or create an account, or something like that.
* New AbortAutoblock hook (for use in TorBlock extension), which allows extensions to cancel autoblocks.
2008-05-23 10:34:11 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Aaron Schulz
e34a925007 * Move affectedRows count up
* Shouldn't need to pass db object here
* Some code style tweaks
2008-04-16 21:07:39 +00:00
Aaron Schulz
e599306830 * Allow for things that call addEntry() to pass in a DB object to make the action and logging be one transaction
* Improve logging transactions for block/delete
2008-04-15 23:34:45 +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
Victor Vasiliev
1bf9ad3bf0 * (bug 12999) introduce ipb_by_text colomn
N.B.: this is schema change (obviously)
2008-02-18 12:16:23 +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
Yuri Astrakhan
c17a9c53af API: enh 10260: Added page protection status query in prop=info. Applied modified patch from Roan Kattouw. 2007-06-18 02:00:23 +00:00
Daniel Cannon
7d3eb4accd (bug 7997) Added ability to Special:Blockip to block users from using Special:Emailuser. 2007-06-07 17:31:08 +00:00
Nick Jenkins
b4d37577b9 Removing or commenting out unused variables or globals, and adding declarations for two arrays. 2007-05-08 09:09:46 +00:00
Tim Starling
4e72474170 Fixed complete breakage of anon-only autoblocks, broken since r20436. 2007-04-20 04:17:15 +00:00
Tim Starling
a4dba3a1ba Reduce query/transaction count. 2007-03-31 17:23:10 +00:00
Aaron Schulz
17b53cedd4 *Fix isInRange(), remove cruft, add "ipv-6" prefix to toHex() and parseRange6(), actually show hidename option for blocks 2007-03-28 05:39:06 +00:00
Aaron Schulz
dd703702a1 *Defer to normaliseRange6() if needed 2007-03-14 17:41:12 +00:00
Aaron Schulz
133d8155fb *Add mHideName parameter for hiding usernames 2007-03-14 05:24:06 +00:00
Aaron Schulz
28772d7e2d *Get range blocks to consider "anononly" while I'm at it 2007-03-12 21:56:31 +00:00
Aaron Schulz
915f83d7b4 *IPv6 sanitizing, avoid use of native hex functions, enlarge ip box for blockip a bit 2007-03-12 21:37:46 +00:00
Aaron Schulz
0bbc7cbe34 *Automatic address expansion, remove redundant check 2007-03-12 19:31:30 +00:00
Aaron Schulz
c1de6176c9 * Add IPv6 support 2007-03-12 07:01:27 +00:00
Nick Jenkins
f88c771756 The war on redundant ampersand usage!
* Convert "$dbw =& wfGetDB( DB_MASTER );" --> "$dbw = wfGetDB( DB_MASTER );"
* convert "$skin =& $wgUser->getSkin();" --> "$skin = $wgUser->getSkin();"

For the time being have not changed the function definitions of wfGetDB() or User::getSkin() [i.e. they are still both return-by-ref], so as to ensure the interface does not change for extensions [some of which may still be trying to run on PHP4 environments]. However presumably at some point this can be changed too.

Also includes tiny tweak to newlines in parserTests - will show 1 rather than 2 newlines between the "Reading tests from" strings when in quiet mode.
2007-01-22 23:50:42 +00:00
Antoine Musso
c771fc9c96 Use Doxygen @addtogroup instead of phpdoc @package && @subpackage 2007-01-20 15:09:52 +00:00
Antoine Musso
b144fcb85d Rename constructors to __constructor 2007-01-20 13:34:31 +00:00
Andrew Garrett
b342a81da0 Well there was no problem in the first place. Nice work Werdna 2007-01-07 07:57:54 +00:00
Andrew Garrett
1e975a47b0 Okay brion, this patch actually /works/. Thanks to the miracles of testing, I can now be certain that it does something other than give a PHP warning. 2007-01-07 06:58:21 +00:00
Andrew Garrett
bafa087e99 Fix regression from r17927 that broke IP::isInRange (and hence the autoblock whitelist). 2006-12-08 10:30:50 +00:00
Nick Jenkins
07f59df83b $fname is not defined / null in these contexts, replacing with __METHOD__ 2006-11-29 12:45:47 +00:00
Nick Jenkins
ae8554c45b Completing code housekeeping stuff for rest of includes/ directory: removing unused local vars, removing unused globals, replacing extract() where simple to do, declaring output arrays before calling preg_match(), and so forth. 2006-11-29 11:43:58 +00:00
Nick Jenkins
a474761d9a Changing lines like this: "extract( $dbw->tableNames( 'page', 'archive' ) );" to be like this: "list ($page, $archive) = $dbw->tableNamesN( 'page', 'archive' );".
Three reasons for this:
1) It's better for analysis tools [which want explicit variable declaration]
2) It's easier for a human to read, as it's completely explicit where the variables came from [which is something you don't get with extract() ]
3) It makes it easier to find everywhere where a variable is used with search/grep [which you can't currently do with $tbl_page variables from things like: "extract($db->tableNames( 'page', 'revision'), EXTR_PREFIX_ALL, 'tbl');"].

Otherwise, from a functionality/efficiency perspective the two forms should be identical.

By doing this have been able run static analysis over the usages of these variables, thus eliminating 5 unneeded table names from calls, plus removing 3 unused calls entirely, and it just feels subjectively slightly nicer to me.
2006-11-27 08:36:57 +00:00
Tim Starling
4ce2ae3eb1 2006-11-27 02:43:36 +00:00
Tim Starling
a5b6bb3c26 oops 2006-11-25 17:32:41 +00:00
Tim Starling
a3a6ac13c3 * Added temporary special-case AOL proxy detection, they're automatically counted as trusted proxies for now.
* Removed wfRangeStartEnd() and wfIsAddressInRange() -- avoid proliferation of global functions.
2006-11-25 16:24:44 +00:00
Andrew Garrett
204e610f28 wfGetIp-> in checking autoblock whitelist in doAutoblock. Kudos to Simetrical for spotting the issue. 2006-11-23 05:10:29 +00:00
Aryeh Gregor
ea36e0918d Revert last three commits. I totally broke autoblock and didn't notice somehow. :| 2006-11-22 23:42:39 +00:00
Aryeh Gregor
a6931256ec More bugs! Why did I only spot these after commit >:| 2006-11-22 23:32:21 +00:00
Aryeh Gregor
4834a89438 Argh, syntax error 2006-11-22 23:27:10 +00:00
Aryeh Gregor
0c04d9885c * Moved Werdna's new IP functions to the IP class
* Handle bad input to new IP::isAddressInRange gracefully (return false)
* Block::doAutoblock always returns a bool now, as the docs say
* Split off Block::isWhitelistedIp from Block::doAutoblock
* Put AOL proxy IPs in whitelist, and also one from Singapore that was troublesome on enwiki (more should be added, probably?)
* Improve some docs
* Fix a bug: check if the passed IP is in the whitelist, not if the request IP is in the whitelist
2006-11-22 23:21:53 +00:00
Andrew Garrett
98a334ad27 * (bug 7883) Added autoblock whitelisting feature, using which specific ranges can be protected from autoblocking. These ranges are specified, in list format, in the autoblock_whitelist system message. 2006-11-22 11:51:49 +00:00
Rotem Liss
57c2844f7b Replacing the manual user and user talk links of the blocker in Special:Ipblocklist to Linker::userLink and Linker::userToolLinks; for that, added the function Block::getBy, to get the blocker user ID. 2006-11-21 18:26:55 +00:00
Tim Starling
2f12a58d93 * Introduced StringUtils.php, populated it with some generic string functions, both new and collected from various other files.
* Removed some backtracking regexes with an O(N^2) worst case, replaced with StringUtils::delimiterReplace(). There is a beneficial functional difference: /*/ is no longer considered to be a complete CSS comment.
* Changed the parser strip state from an array to an object. This should hopefully avoid the PHP bugs with array references. StripState uses the new ReplacementArray to do the replacements, thereby supporting FSS. 
* Removed DatabaseFunctions.php from the default startup sequence. Moved wfGetDB() to GlobalFunctions.php.
* Introduced the SiteStats class, with a collection of cached site stats accessor functions.
* Removed all global functions from Parser.php, they don't belong there.
* Made LanguageConverter use the new ReplacementArray class instead of managing its own FSS objects.
2006-11-21 09:53:45 +00:00
Andrew Garrett
a861fd02b6 Fix bug reported by Slowking_Man where retroactive autoblocks take effect even if the user being blocked was already blocked with autoblocks disabled. 2006-11-20 06:01:45 +00:00
Andrew Garrett
23021c7915 Make pretend feature from last commit actually exist 2006-11-13 06:44:37 +00:00
Andrew Garrett
8671e7cda8 * (bug 5149) When autoblocks are enabled, retroactively apply an autoblock to the most recently used IP of a user when they are blocked.
* Add an index on (rc_user_text,rc_timestamp) on the recentchanges table. This will make CheckUser.php and the new retroactive autoblock functionality faster.
2006-11-08 09:54:06 +00:00
Andrew Garrett
65957ef12c Various fixes related to the blocking change re: autoblocks. On inserting an IP block, the ipb_enable_autoblock field is now automagically blanked, because it doesn't make any sense for an IP block. Additionally, IP blocks without the ipb_enable_autoblock option no longer show up as "autoblock disabled" on Special:Ipblocklist. 2006-11-03 13:24:53 +00:00
Andrew Garrett
05f4492f06 Restore patch that was temporarily reverted in order to rectify an issue where the patch was applied without enacting required database changes 2006-11-01 21:57:18 +00:00
Andrew Garrett
5941189de0 Revert patch that was scapped into production without database changes 2006-11-01 21:36:03 +00:00
Tim Starling
329b012d2b Added block option "enable autoblocks". Patch by Werdna from bug 1294. 2006-11-01 07:13:31 +00:00
Brion Vibber
6966ffb95e * Fix regression which allowed some blocked users to create additional accounts 2006-07-17 06:28:06 +00:00
Tim Starling
0ade783ae2 Deferred loading of DateFormatter.php and IP.php. Standardised IP.php function naming style. 2006-07-14 17:02:49 +00:00
Antoine Musso
71fd92d760 Migrate IP related tools from ProxyTools.php to IP.php
and its own class of static functions
2006-07-12 18:33:21 +00:00
Tim Starling
1b1e8a498a Give manual blocks precedence over autoblocks 2006-07-11 05:30:35 +00:00
Tim Starling
23f2b6b5c5 Ignore ipb_anon_only and ipb_create_account for username blocks. 2006-07-10 08:38:22 +00:00
Tim Starling
1d9922db64 * Allow blocks on anonymous users only.
* Allow or disallow account creation from blocked IP addressess on a per-block basis.
* Prevent duplicate blocks. 
* Fixed the problem of expiry and unblocking erroneously affecting multiple blocks. 
* Fixed confusing lack of error message when a blocked user attempts to create an account. 
* Fixed inefficiency of Special:Ipblocklist in the presence of large numbers of blocks; added indexes and implemented an indexed pager.
2006-07-10 06:30:03 +00:00
Domas Mituzas
f6efd8b094 screw global defines :) 2006-06-08 13:21:42 +00:00
Brion Vibber
0a26267688 Revert to r14512; domas introduced massive breakage with incomplete experimental changes. They will be recommitted when they work. :) 2006-06-01 08:19:02 +00:00
Domas Mituzas
bda0b8e104 Use AutoLoader to load classes:
* remove require_once() throughout whole code, yet left in few places
* move global functions in HttpUtils, ProxyTools, Credits to class methods
* php5 only: __autoload() now used, combined with class->file map and require()
* move initialization of $wgValidSkinNames to Skin::getSkinNames()
* few more changes that will surely break stuff.
2006-06-01 07:22:49 +00:00
Antoine Musso
7ebdb6de89 Revert to r14165 . Did too many changes, didnt even run parserTests (i am bad) 2006-05-11 22:40:38 +00:00
Antoine Musso
bc14eb8045 Replacing var keyword with private / public as we now require PHP5. 2006-05-11 19:10:41 +00:00
Rob Church
de243b1e3e * Minor cosmetic fixes to installer
* Make Block::delete() return something, to be used in later alterations to the un/blocking interfaces
2006-01-16 03:35:28 +00:00
Ævar Arnfjörð Bjarmason
a26d5a49d7 * s~\t+$~~ 2006-01-07 13:31:29 +00:00
Ævar Arnfjörð Bjarmason
7bbe971aec * s~ +$~~ 2006-01-07 13:09:30 +00:00
Tim Starling
55671d7040 Faster IP blocks. Requires schema change. 2005-12-01 10:37:47 +00:00
Brion Vibber
219094eb01 Committing various live hacks from Wikimedia servers 2005-10-22 20:52:30 +00:00
Tim Starling
592eb90345 faster expiry check in enumBlocks 2005-09-11 13:43:49 +00:00
Brion Vibber
534476c282 * (bug 3284) Ipblocklist paging, substring search 2005-08-27 23:51:29 +00:00
Brion Vibber
b1a49e2d5b Drop MySQL 3.23.x support; 4.0 or greater required. 2005-08-26 23:02:54 +00:00
Brion Vibber
23ec039bda * Fix table prefix usage in Block::enumBlocks 2005-08-23 20:38:46 +00:00
Tim Starling
702db53968 Faster retrieval of range blocks, faster lookup of blocked by name 2005-08-23 16:52:42 +00:00
Tim Starling
e509893941 Made BlockCache::loadFromDB() 100x faster. Wasn't an issue before ryo commented out the memcached bits, but since then, it was adding 1100ms to the save time 2005-08-21 06:07:48 +00:00
Antoine Musso
7aad79cbc8 Hack #1487: Special:Ipblocklist outputs <ul></ul> which is not valid XHTML. 2005-08-11 05:23:04 +00:00
River Tarnell
b817c0c15f merge ORACLE_WORK. sorry, this may break some parts of MySQL, i did not test extensively. 2005-08-02 13:35:19 +00:00
Tim Starling
7e63648db4 Formalising live performance hack 2005-07-25 06:57:12 +00:00
Magnus Manske
7d554d1ad5 Bypassing UNION SQL for mysql3 2005-03-18 09:20:17 +00:00
Brion Vibber
4049a9d9e1 * Respect read-only mode on block removals 2005-03-08 02:45:25 +00:00
Jens Frank
7794c7c965 converted comments to PHPDOC format 2005-01-22 08:30:39 +00:00
Brion Vibber
7d099581ba * (bug 1184) expiry time of indefinite blocks shown as the current time
This code's a bit hacky, and may not work with PostgreSQL (check NULLs etc)
2005-01-11 09:29:29 +00:00
Brion Vibber
ae6aaa564b * (bug 1204) Blocks do not expire automatically 2005-01-11 08:05:22 +00:00
Jens Frank
ceb415f7ed BUG#1244 Use a UNION to improve index use. 2005-01-01 11:50:19 +00:00
Evan Prodromou
4b42f18b66 Removed CVS keywords from files, to make merging between branches
easier. Interpolated keywords cause lots of conflicts and headaches at
merge time for older (<1.12.x) CVS versions.
2004-11-29 18:25:30 +00:00
Tim Starling
412eda0517 Correcting bugs due to double-prefixing table names. Removing obsolete Database member functions. Adding comments to Database.php 2004-10-24 07:10:33 +00:00
Domas Mituzas
0cadad0299 fix timestamp for expiry too 2004-09-07 06:26:15 +00:00
Domas Mituzas
525c3345be timestamp fix, PR405 2004-09-07 06:20:51 +00:00
Antoine Musso
ba2afcd9fa Split files and classes in different packages for phpdocumentor. I probably changed some double quotes to single and used function foo () { shema 2004-09-03 23:00:01 +00:00