Commit graph

37577 commits

Author SHA1 Message Date
Ian Baker
a26afff4e0 Cleaning up little things, updates to code clarity, documentation fixes per Catrope's suggestions.
followup to r94536, r94592, r94594
2011-08-16 17:57:32 +00:00
Mark A. Hershberger
c34a569d51 w/s changes 2011-08-16 16:03:29 +00:00
Roan Kattouw
c26e52d255 Fix some indentation and comments in mediawiki.Title, and make it depend on mediawiki.util 2011-08-16 15:32:08 +00:00
Alexandre Emsenhuber
062e2723ba Some misc fixes to tests:
* Don't create a WebRequest instance to put in $wgRequest in test since it is meant for HTTP requests, not command line ones
* Force $wgAlwaysUseTidy to false in ExtraParserTest, having it to true breaks testBug8689() and testParse()
2011-08-16 15:17:35 +00:00
Antoine Musso
ab0ebed3fd Tests for wfGetIP() follow up r89407
* wfGetIP() now support resetting its internal static variable. Thanks to
Platonides which introduced this trick with r92960.
* Various tests for $_SERVER['REMOTE_ADDR'] and $wgCommandLineMode.

revert r94575:
 - reenable testGetFromServerRemoteAddr() which was not an issue

reintroduce r94558:
 - per CR on r94558 by Aaron use meaningful parameter to wfGetIP() when
   resetting the static variable ( 'reset' instead of true).
 - keep testLackOfRemoteAddrThrowAnException() test in the broken group
   with a comment for later fixing.

TODO:

- implements tests for XFF headers.


TEST PLAN:

$ ./phpunit.php --filter wfGetIP --testdox
PHPUnit 3.5.14 by Sebastian Bergmann.

wfGetIP
[x] Get loopback address when in command line
[x] Get from server remote addr
[x] Lack of remote addr throw an exception
$
2011-08-16 14:15:07 +00:00
Roan Kattouw
f764c6fab3 Followup r89853, tweaks for jquery.qunit.completenessTest:
* Don't assume $ as a global, but alias it to jQuery instead. The code is already wrapped in a closure so this is easy
* Remove unused constants TYPE_SIMPLEFUNC and TYPE_OBJCONSTRFUNC
* Fix spelling in comments, mostly brake->break
* Fix whitespace
* Kill useless return at the end of a void function
* Correct comment in hasTests() which claims the function does the opposite of what it really does
2011-08-16 13:33:22 +00:00
Roan Kattouw
9a426f2a14 Followup r89545: add ,0 to Article constructor call 2011-08-16 12:48:05 +00:00
Roan Kattouw
c004e4ba8c Followup r90041: keep naming of watch and unwatch calls consistent 2011-08-16 12:46:15 +00:00
Alexandre Emsenhuber
d49f6e68bd Per Reedy, follow-up r93758: SpecialPage::capturePath() now has incorrect signature. Removed the function rather than updating it, since it's not called at all and current behavior is incompatible with the old one. 2011-08-16 11:05:19 +00:00
Antoine Musso
3a5a0a394d correct number of tests fu r94609 2011-08-16 10:29:29 +00:00
Antoine Musso
3cbde340d8 force QUnit charset to UTF-8 2011-08-16 10:28:05 +00:00
Antoine Musso
357c050b77 tests for jquery.highlightText
In r90092, wikinaut requested tests for our highlightText jQuery plugin.
Here is a basic framework than almost anyone can enhance :-)
2011-08-16 08:04:34 +00:00
Brian Wolff
9ccad8e8b3 follow-up r88171 - fix fatal if suggested filename has illegal character in it.
Check to make sure the title object actual exists, before checking its namespace,
since alll the does this have illegal chars check is done after the does it
start with file: check.

For future note though, when using upload by url feature, the suggested
destination name when you put http://upload.wikimedia.org/wikipedia/commons/e/e0/Petrorhagia_prolifera_%281%29.JPG is illegal, which is probably not very user-friendly (filed as bug 30390)
2011-08-16 05:37:18 +00:00
Sam Reed
dbf85a36bd Explicitally define some member variables
Fix/update/add to comments

Add some braces
2011-08-16 00:41:50 +00:00
Ian Baker
53f3c48a95 Removed the ability to pass a key into stashFile(), which simplifies the stash row creation a great deal.
Updated UploadFromUrlJob to properly use the database stash
followup to r92200
2011-08-15 23:58:40 +00:00
Ian Baker
36babe9a7d Removed complex replag handling, now just query master when record isn't present on slave.
followup to r92009
2011-08-15 23:40:57 +00:00
Antoine Musso
56cc7371dd back off r94558:
- reverts ./includes/ProxyTools.php
 - marks tests broken

In our test suite, the first call to wfGetIP() set the static variable.
Hence the remaining of the code is only tested on the first call to it.
Resetting the static variable enlight a bug somewhere in our code where
we are calling wfGetIP() but can not reliably get an IP, somehow REMOTE_ADDR
does not exist and $wgCommandLineMode is disabled.
Will have to track this bug further when I got time.
2011-08-15 21:45:18 +00:00
Antoine Musso
13023f92a5 avoid playing with $_SERVER in test for now
fu r94558
2011-08-15 21:18:23 +00:00
Brion Vibber
3cfb43ee4f Revert r94041: PHP Notice: Undefined index: SERVER_PROTOCOL in /home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/includes/Exception.php on line 185
This code appears to be trying to output something like 'HTTP/1.1 500 MediaWiki Error', but using $_SERVER['SERVER_PROTOCOL']. And it seems to output it on things that run in phpunit tests.
Seems pretty broken?
2011-08-15 21:04:11 +00:00
Antoine Musso
aecf8ea396 Tests for wfGetIP() follow up r89407
* wfGetIP() now support resetting its internal static variable. Thanks to
 Platonides which introduced this trick with r92960.
* Various tests for $_SERVER['REMOTE_ADDR'] and $wgCommandLineMode.

TODO:

- implements tests for XFF headers.


TEST PLAN:

$ ./phpunit.php --filter wfGetIP --testdox
PHPUnit 3.5.14 by Sebastian Bergmann.

wfGetIP
 [x] Get loopback address when in command line
 [x] Get from server remote addr
 [x] Lack of remote addr throw an exception
$
2011-08-15 20:16:15 +00:00
Antoine Musso
9e2f7ebb7d PHPUnit test file must end with 'Test.php'
follow up r92045
2011-08-15 19:39:55 +00:00
Sam Reed
9f785bc597 Followup r92430 per CR, like r94448 2011-08-15 18:56:37 +00:00
Brion Vibber
95300b2e55 Followup r94541 (reverts of r94289 undiscussed core schema change and followups), two more that got missed: reverts of r94290, r94364 2011-08-15 18:52:33 +00:00
Aaron Schulz
977ce7e45e Restored r94370 changes PopulateRevisionLen, moving it to $postDatabaseUpdateMaintenance 2011-08-15 18:52:25 +00:00
Sam Reed
8588e3e15e Partial revert to r87584
To fix bug bug 30355 importImages.php Internal Error
2011-08-15 18:35:19 +00:00
Brion Vibber
5ce010f85c Revert r94289, r94290, r94294, r94333, r94345, r94362, r94370 -- core schema change with no discussion 2011-08-15 18:24:38 +00:00
Ian Baker
6410788a46 checking for existence of mLocalFile in stashFile() was inverted
followup to r94536
2011-08-15 18:19:54 +00:00
Ian Baker
6b292f7804 cleaned up database query, doesn't have to be aware of column names anymore (thanks Catrope!)
followup to r92009
2011-08-15 18:17:51 +00:00
Ian Baker
9cb2d4743a Fixed incorrect usage of || operator, added test
removed spurious use of empty()
listFiles() was broken, now works
followup to r92009
2011-08-15 18:10:10 +00:00
Antoine Musso
08334c06c8 Fix up NS_MAIN subpage tests
Per CR on r92234, this correctly test hasSubpages independently from your
local configuration.  Also test altering the global and having static
methods reacting accordingly.
2011-08-15 14:17:45 +00:00
Roan Kattouw
5581a5e837 Followup r94502: per CR, use two caching variables instead of an array indexed with true or false 2011-08-15 13:16:10 +00:00
Roan Kattouw
fc6dcf859b Add parser test for r94502 2011-08-15 12:25:01 +00:00
Roan Kattouw
48bbe8b848 (bug 30269) Strings like foobar//barfoo are linked to become foobar[//barfoo]
* Introduce a boolean parameter to wfUrlProtocols() which, if set to false, will cause '//' to be dropped from the returned regex so it doesn't match protocol-relative URLs
* Introduce wfUrlProtocolsWithoutProtRel() as a wrapper for wfUrlProtocols( false ). The latter should not be used directly because the former is much clearer
* Use this new function in Parser::doMagicLinks() to fix the original bug. Also use it in ApiFormatBase::formatHTML() and CodeCommentLinker::link(), which probably had similar bugs
2011-08-15 12:20:00 +00:00
Rotem Liss
4c56a0a380 Localization update for he. 2011-08-15 10:31:23 +00:00
Antoine Musso
1017746597 Fix space/tab indentation FU r94444 2011-08-15 10:23:48 +00:00
Ryan Schmidt
88152f01f7 * Revert r94487 and r19889 to an extent -- ONLY check for the X-Forwarded-For header when we are behind a proxy, as mostly every properly configured proxy software sets it, and attempting to support those that do not opens up the ability to spoof IP addresses by setting arbitrary headers. 2011-08-15 05:25:56 +00:00
Ryan Schmidt
b921ebcb7f * Follow-up r92673: add documentation on how to use $wgDnsBlacklistUrls to DefaultSettings (lifted from the Manual page on mediawiki.org) 2011-08-15 05:12:56 +00:00
Ryan Schmidt
6b20263893 When MediaWiki is being run behind a proxy, also check the X-Real-IP header to determine the client's actual IP address (some servers such as nginx might set this instead of X-Forwarded-For depending on configuration). 2011-08-15 04:50:51 +00:00
Ryan Schmidt
f7ae0b261d * Follow-up to r91284: fix error in Action::exists by passing empty array as required second parameter to Action::getClass 2011-08-15 04:02:08 +00:00
Alexandre Emsenhuber
76478abafe Added Parser::recursivePreprocess(); like preprocess() but doesn't call startParse() so that it can be used inside a parse operation using the same context without having to mess with other functions
Simple use case (PHP 5.3+) that will work show the expand text passed to a <preprocess> tag:
$wgHooks['ParserFirstCallInit'][] = function( $parser ) {
	$parser->setHook( 'preprocess', function( $text, $attr, $parser, $frame ) {
		return $parser->recursivePreprocess( $text, $frame );
	} );
	return true;
};
2011-08-14 20:22:52 +00:00
Alexandre Emsenhuber
f4d0f5dfba Use local context instead of global variables 2011-08-14 19:54:04 +00:00
Sam Reed
e159eb114e Fix fail from r94473
Append to the string, don't replace it
2011-08-14 19:50:08 +00:00
Sam Reed
dd2c01af83 Add/update documentation 2011-08-14 19:49:07 +00:00
Sam Reed
8a42c19f41 Made Xml::buildTable() wrap header stuff in <thead></thead> 2011-08-14 19:47:44 +00:00
Daniel Friesen
6007684f57 Add code to the sanitizer to convert presontational attributes that were removed in html5 into inline css. This allows wiki to keep using them in short loose WikiText but still output valid modern markup.
Note that there were some attributes excluded. Namely stuff on img and object, and the table cellspacing and cellpading which aren't easily converted into inline css.
2011-08-14 16:41:53 +00:00
Daniel Friesen
22b0fc2f10 This Sanitizer::EVIL_URI_PATTERN is completely inadequate for actual security as there are numerious ways to bypass blacklisting.
Since it's only used right now for paranoia in cases you currently can't actually exploit a browser we let it slide.
However this thing needs a big fat warning message next to it to avoid someone thinking this is actually a good idea for security and ending up later on using it and opening up an XSS hole in core.
2011-08-14 14:59:26 +00:00
Leo Koppelkamm
3b9dfce163 Fix r94429 : Left and right side are still nearly the same color for 7% of the population. When I wrote to the list a while ago, no one argued for keeping the yellow scheme just because we're used to it. This makes it red/blue, also increases the highlight area ands adds a subtle border per Brandon Harris 2011-08-14 14:40:56 +00:00
Daniel Friesen
ecd274f432 Followup r94353; Use !== null since that's what we use in core. 2011-08-14 14:20:59 +00:00
Daniel Friesen
14f758d2c1 Followup r94375; Use PROTO_RELATIVE so that when $wgServer is a protocol relative url we don't potentially polute the cache if getFullURL is called by an extension that outputs to cache. getFullURL includes a #fragment so it's more likely that extensions outputting urls in situations that don't support protocol relative urls are using getLocalURL and expanding it. 2011-08-14 14:07:12 +00:00
Roan Kattouw
b3599d8f8c Followup to r92580 and r93820: r92580 duplicated the call to wfExpandUrl(), and r93820 caused them to get out of sync. 2011-08-14 13:35:06 +00:00