Commit graph

4211 commits

Author SHA1 Message Date
Brian Wolff
f12a3edff7 Remove passwordreset capture feature
If anyone wants such a thing, they can make their own extension.

I asked stewards, and they said they don't use this.

See also T32636 / 9de2bfd1fe

Bug: T150930
Change-Id: I3ab5962dba668e5d628e55ad0c0feae471d82b5e
2016-11-23 00:02:33 +00:00
Antoine Musso
2ee1e76266 test: fix @covers to non existent methods
MediaWikiTestCase::restoreLogger has been rename to plural form.

Cause:
    Trying to @cover or @use not existing method
    "MediaWikiTestCase::restoreLogger".

Change-Id: I4625f18992f62046e65c60ceca67d9aec170ccdc
2016-11-22 16:25:03 +01:00
addshore
650a0279d8 Remove unused MediaWikiTestCaseTest::GLOBAL_KEY_NONEXISTING
Follow up to I6a1cf9a2e436978a6068cecdaf74aa58b31100ab
d544acdbbb

Change-Id: Ifaa8808aa4df72fbface99cc625bdaaba6e9b087
2016-11-21 12:57:20 +00:00
jenkins-bot
b330e5a736 Merge "Add 'tests' testsuite" 2016-11-18 21:14:47 +00:00
jenkins-bot
d1f572501b Merge "Allow stashing of unset globals in MWTestCase" 2016-11-18 21:09:35 +00:00
addshore
87b59b2b91 Add 'tests' testsuite
This also fixed the testLoggersAreRestoredOnTearDown
test which was broken, and factors it out into
3 seperate tests

Bug: T151081
Change-Id: I00d29b501fa84db22e3bcd3d5642c49b2e99d4a0
2016-11-18 19:41:27 +00:00
jenkins-bot
5111bd2def Merge "Add 'autocomplete' option to HTMLTextField" 2016-11-18 18:41:16 +00:00
addshore
d544acdbbb Allow stashing of unset globals in MWTestCase
Change-Id: I6a1cf9a2e436978a6068cecdaf74aa58b31100ab
2016-11-18 14:59:49 +00:00
Gergő Tisza
8f17b09a9f Add 'autocomplete' option to HTMLTextField
Adds support for the 'autocomplete' HTML attribute to HTMLTextField
(mainly for turning it off, but other values are supported as well).
Renames 'autocomplete' to 'autocomplete-data' (with temporary B/C)
in HTMLAutoCompleteSelectField to make space.

Change-Id: Ic0539d5a61d9862e670d10686adc1e41f65d908e
2016-11-17 19:50:38 +00:00
jenkins-bot
b90fa4201a Merge "resourceloader: Remove top/bottom queue distinction" 2016-11-17 14:27:07 +00:00
jenkins-bot
bcea7fcb1c Merge "resourceloader: Add tests to verify empty string works" 2016-11-17 01:46:03 +00:00
Timo Tijhof
6f5cb7d42b resourceloader: Add tests to verify empty string works
It's not explicitly supported anywhere, but I don't see a point in explicitly
disallowing it. Add unit tests to verify that this works.

Bug: T28804
Change-Id: I876ac43885bb27da54ef6e59b6416868ff636b84
2016-11-16 17:15:04 -08:00
Aaron Schulz
a1e5fd85a0 Fix UserTest case that was missing a cache purge
The process cache is based on blind-TTL, so purge it to
test the persistent cache properly.

Change-Id: I8ee78a1e73bf5164e74b1e8a23559c2e91bba6dd
2016-11-16 16:38:09 -08:00
Timo Tijhof
bc374082fa resourceloader: Remove top/bottom queue distinction
* The styles queue has always been top-only
  (except for a few months in 2015).
* The top queue loads asynchronous since mid-2015. (T107399)
  And LocalStorage eval, previously the last remaining non-async part
  of module loading, is also async as of October 2016. (T142129)

* This change merges the bottom 'mw.loader.load()' queue with the top queue.
  It also moves any other snippets potentially in the bottom queue still:
  - embed: I couldn't find any private modules with position=bottom
     (doesn't make sense due to their blocking nature). If any do exist,
     (third-party extensions?), they'll now be embedded in the <head>.
  - scripts: Any legacy 'only=scripts' requests will now initiate
     from the <head>.

Bug: T109837
Change-Id: I6c21e3e47c23df33a04c42ce94bd4c1964599c7f
2016-11-16 19:29:16 +00:00
Tyler Anthony Romeo
1cc3a57296 Send a cookie with autoblocks to prevent vandalism.
Send a cookie with blocks that have autoblock turned on so that
the user will be identified to MediaWiki and any IP they try
to edit anonymously from will be blocked, even without logging
in to the originally blocked account. Additionally, the block
info is stored in local storage as well as an even stronger
deterrence.

Note: this is meant to deter normal vandals, i.e., not attackers
who know what cookies and local storage are and will be actively
removing the cookie.

This feature is disabled by default, and can be enabled with the
new $wgCookieSetOnAutoblock configuration variable (by setting
it to true);

The cookie will expire at the same time as the block or after
$wgCookieExpiration (whichever is sooner).

Bug: T5233
Bug: T147610
Change-Id: Ic3383af56c555c1592d272490ff4da683b9d7b1b
2016-11-16 10:29:46 -08:00
Bryan Davis
a263b8d915 Throttler: improve log message compatibility with Monolog logger
The `type` log event attribute is used in Wikimedia production logging
to categorize log events by source (e.g. 'mediawiki', 'restbase', etc).
Adding a `type` key to the logging context overwrites the default value
of 'mediawiki'. Rename the key to `throttle` in the context and the
message template.

Change-Id: Ic274159774e43a8749f83c850fff7897956cf377
2016-11-15 22:37:04 +00:00
Thiemo Mättig
ae72e3577f More robust, cleaned up MessageTest
This is a direct follow up to my comments in Ia6ec10d.

Relevant for T146416 are the two messages I added. They explain why these
assertions are duplicated.

assertEquals behaves bogus when used with strings, especially when used
with formatters and parsers, which is the case here. For example,
assertEquals( '9a', 9 ) succeeds. assertEquals is useful when comparing
objects.

Bug: T146416
Change-Id: Ie8df41b3ce6678f3add55bab6701b56b66447a2e
2016-11-11 16:48:14 +00:00
jenkins-bot
81087198c2 Merge "Validate getExamplesMessages() query strings" 2016-11-10 20:50:15 +00:00
jenkins-bot
c99b37bdc0 Merge "Deprecate Message::$format (mostly)" 2016-11-10 18:47:45 +00:00
jenkins-bot
97c2bc99ea Merge "Add Message test for implicit formatting" 2016-11-10 18:45:12 +00:00
Brad Jorsch
af1dfeead5 Validate getExamplesMessages() query strings
Assert that they don't begin with 'api.php?'.

Change-Id: Idf5e8e08863a379a37a427a11936e5f9ce567396
Depends-On: I8a82eecefbb0ba327d8e8bc24ec535bcf40e6429
Depends-On: I476aad09655a2822381a2c61690b4b0ad423151e
2016-11-10 10:17:04 -05:00
Gergő Tisza
b0784a8e96 Deprecate Message::$format (mostly)
Message::__toString() used the same formatting mode that the last
explicit transformation used:

    $msg = new Message( 'foo' );
    echo $msg; // escaped
    echo $msg->plain();
    echo $msg; // not escaped

This is not particularly useful and makes code review hard, so let's
get rid of it.

The same behavior with $msg->toString() is left intact (and logged)
for now.

Bug: T146416
Change-Id: Ia9b2a1dcf09d52348b2c6d8299fd849b809f6e74
2016-11-10 09:06:26 +00:00
jenkins-bot
1dd2e07276 Merge "Revert "Don't construct SpecialPages twice"" 2016-11-10 06:00:17 +00:00
Legoktm
d82eec166f Revert "Don't construct SpecialPages twice"
This causes issues with transcluded special pages.

This reverts commit ba40a63c0e.

Bug: T132545
Change-Id: I14d5300d6b90766532924f9d1e52c4230e2d9772
2016-11-10 05:48:33 +00:00
Gergő Tisza
4ea621e236 Add Message test for implicit formatting
Change-Id: Ia6ec10d0d6da8c2b323054642e206c722d17f0b0
2016-11-09 04:00:44 +00:00
jenkins-bot
84851a43f3 Merge "Revert "MediaWiki.php: Redirect non-standard title urls to canonical"" 2016-11-09 01:27:38 +00:00
jenkins-bot
69ae945e8d Merge "Update weblinks in comments from HTTP to HTTPS" 2016-11-08 21:32:00 +00:00
jenkins-bot
05c72943a7 Merge "Remove empty lines at end of functions" 2016-11-07 15:56:56 +00:00
Fomafix
202f695f67 Update weblinks in comments from HTTP to HTTPS
Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link.

Also update some defect links.

Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
2016-11-07 15:24:46 +01:00
Leszek Manicki
d5a12f954b Remove not used variables in ResourcesTest
Change-Id: I45f531e66545175c689b8f6a62a5c3ed62ea5a9a
2016-11-05 20:28:32 +00:00
umherirrender
34fe90ac52 Remove empty lines at end of functions
It looks like there is something missing after the last statement
Also remove some other empty lines at begin of functions, ifs or loops
while at these files

Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
2016-11-05 11:55:10 +01:00
Brad Jorsch
715cbe468b Add hooks for WatchedItemQueryService / ApiQueryWatchlist
In order for an extension to add data to ApiQueryWatchlist, we need to
provide a way to allow it to manipulate the database query made by
WatchedItemQueryService. We also need some hooks in ApiQueryWatchlist to
handle the marshalling of data to and from WatchedItemQueryService.

To better handle hooking, this also moves some of the continuation logic
from ApiQueryWatchlist to WatchedItemQueryService.

Bug: T147939
Change-Id: Ie45376980f92da964a579887b28175c00fd8f57e
2016-11-03 11:41:40 +00:00
jenkins-bot
df3dd27240 Merge "CSSMin: Correctly avoid fallbacks when embedding SVG files" 2016-11-02 18:33:17 +00:00
jenkins-bot
19cd639835 Merge "SpecialActiveUsers: Change checkboxes to dropdown" 2016-11-02 16:50:28 +00:00
Sethakill
d115a79923 SpecialActiveUsers: Change checkboxes to dropdown
Moved form to new function and
fixed text about cached version.

Bug: T116354
Change-Id: I29ae63472536f99f7f9546f30d86e7bd324d3094
2016-11-02 12:21:26 +00:00
Bartosz Dziewoński
c48e061f67 CSSMin: Correctly avoid fallbacks when embedding SVG files
The check for file existence before checking its MIME type was
building the path incorrectly, causing this piece of code to always
think the file does not exist. (The code to actually embed the file
was correct.)

This was not caught by the tests before of a bug in the test code,
which cancelled out this one.

Bug: T100958
Change-Id: I4469079f41d48052d0a02f98bb1ed02407abd54c
2016-11-02 10:26:21 +01:00
Sam Wilson
66e215baee Remove spaces after cast operators
This fixes the outstanding mis-spaced cast operators to bring them
into line with the coding standards on mediawiki.org (and with the
more common usage within this codebase).

Bug: T149545
Change-Id: Ib7bcf95bbee83d20c05f6d621ce7b4e1fb58a347
2016-10-31 13:57:39 +00:00
Aaron Schulz
8d61cf2793 Make LBFactoryTest.php pass for sqlite
Change-Id: I4fe929e82218231f6c8afa64da8c0ccb42d2c362
2016-10-28 22:56:39 -07:00
jenkins-bot
8803fab270 Merge "Add Parser to MediaWikiServices" 2016-10-28 17:53:30 +00:00
jenkins-bot
53779578b4 Merge "Introduce InterwikiLookupAdapter on top of SiteLookup" 2016-10-28 13:25:18 +00:00
jenkins-bot
9e8cdbbb66 Merge "UploadBase: Permit SVG files with broken namespace definition (Inkscape bug)" 2016-10-27 10:49:57 +00:00
Bartosz Dziewoński
19d692051f UploadBase: Permit SVG files with broken namespace definition (Inkscape bug)
Inkscape mangles namespace definitions created by Adobe Illustrator
(apparently it can't parse custom entities or something, maybe just
in 'xmlns' attributes). These files are still valid SVG, and not
a security issue (although Illustrator probably won't like them),
so it's okay to allow them.

Added tests with some example files.

* buggynamespace-original.svg
  File generated by Illustrator (edited by hand to reduce filesize).
  Based on <https://commons.wikimedia.org/w/?curid=16495597>.

* buggynamespace-okay.svg
  The original file, opened and saved in Inkscape (no other changes).

* buggynamespace-okay2.svg
  The original file, opened and saved in Inkscape twice.

* buggynamespace-bad.svg
  The original file, edited by hand to remove custom entities.
  This is not valid XML and should be rejected (although it's valid
  when parsed as HTML, and some image viewers might display it).

* buggynamespace-evilhtml.svg
  An SVG file using an entity declared namespace for a namespace
  we want to ban. Based on buggynamespace-original.svg.

Bug: T144827
Change-Id: I0eb9766cab86a58d729f10033c64f57d2076d917
2016-10-27 10:24:32 +00:00
Yuri Astrakhan
ab224f8211 Added array_replace_recursive merge strategy
For extension registry, add array_replace_recursive merge strategy,
as some extensions/configuration may prefer that to array_merge_recursive.

In some cases, configuration is merged from multiple extensions,
such as JsonConfig's $wgJsonConfigs configuration: ZeroBanner defines

	"JsonZeroConfig": {
		"namespace": 480,
		"nsName": "Zero",
		"isLocal": false,
		"cacheKey": "1"
	}

and mobile.php overrides it with
	$wgJsonConfigs['JsonZeroConfig']['isLocal'] = false;
	$wgJsonConfigs['JsonZeroConfig']['remote'] = [
		'url' => 'https://zero.wikimedia.org/w/api.php',
		'username' => $wmgZeroPortalApiUserName,
		'password' => $wmgZeroPortalApiPassword,
	];

Having identical value 'isLocal' would be converted into an array
if array_merge_recursive is used, but the replace strategy fixes it.

Change-Id: Ica6ddd0ae76f23e60de9b6235c6e2a3f2754a95d
2016-10-24 19:20:04 +00:00
jenkins-bot
e49b03c2f0 Merge "objectcache: avoid using process cache in nested callbacks" 2016-10-21 01:23:30 +00:00
Aaron Schulz
43ff2a83b5 objectcache: avoid using process cache in nested callbacks
Because the process cache can be lagged by virtue of blind TTL,
the HOLDOFF_TTL might not be enough to account for it, so avoid
using it when already inside a callback.

Also split of the tests from the MediaWiki test class, so this
does not require DB access anymore.

Change-Id: I743a1233a5efc7f036fad140a9ff8a30b32f8f27
2016-10-20 22:13:29 +00:00
Aaron Schulz
0852a000a5 Add caching to ResourceLoaderWikiModule::preloadTitleInfo()
This is one of the top three DB queries showing up in xenon
reverse flamegraph profiling.

It works via a per-wiki check key that is bumped whenever
someone changes a .js or .css page on that wiki.

Change-Id: I73f419558864ba3403b4601a098f6aaf84a3e7c1
2016-10-20 20:54:11 +00:00
Amir Sarabadani
56195efaa1 Introduce InterwikiLookupAdapter on top of SiteLookup
This adapter assumes the db name (Interwiki wiki id) equals global ids.

Bug: T135146
Change-Id: I387dc2ff3f5564fcedde835dec66781d8e9424fd
2016-10-18 10:18:31 +00:00
jenkins-bot
3588c0ac81 Merge "Use namespaced ScopedCallback" 2016-10-17 23:32:37 +00:00
Kunal Mehta
61adc1e146 Use namespaced ScopedCallback
The un-namespaced \ScopedCallback is deprecated.

Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
2016-10-17 15:46:05 -07:00
Kunal Mehta
f73a68e15c Move most of MWCryptHKDF into libs
Dependency-inject the MediaWiki-specific parts into a CryptHKDF
instance, which MWCryptHKDF wraps around.

Change-Id: Idff18635cfd8a3d93ea2ca8d56cdbd11eb4d3b2b
2016-10-17 22:16:17 +00:00