lhc/web/wiklou.git
7 years agoRevertAction: Prevent file revert if current version is identical
Bartosz Dziewoński [Thu, 1 Sep 2016 21:49:19 +0000 (23:49 +0200)]
RevertAction: Prevent file revert if current version is identical

There are several reasons for this:

* The file thumbnail shown on the main file page is cached by the
  browser, as images tend to be. This often confuses users into
  thinking their revert did not work, and into attempting it again.
  Recent examples:
  * https://commons.wikimedia.org/wiki/Commons:Village_pump/Archive/2016/07#Wrong_SVG_rendering_on_File:DuckDuckGo_logo_and_wordmark.svg
  * https://commons.wikimedia.org/w/index.php?title=Commons:Upload_help&oldid=205348523#Reversion_is_not_working_for_me.
  Ideally we'd prevent the caching, but preventing repeated reverts
  should also work.

* Refreshing the success page causes the revert to be attempted again
  (T53383). The usual solution to this is the Post/Redirect/Get
  pattern, but we want to show a success message so that would require
  some more changes (something similar to the post-edit notification).

* It can serve as a "revert conflict" detection mechanism, crude but
  better than none.

In the unlikely case that uploading an identical older version of
the file is necessary, it can still be done using Special:Upload.

Bug: T53383
Change-Id: I37e04a536c5c2fc6cdbe59f6f598bb0c7f25d7a7

7 years agoImageHistoryList: Remove 'wpEditToken' parameter from the "revert" link for files
Bartosz Dziewoński [Thu, 1 Sep 2016 20:59:55 +0000 (22:59 +0200)]
ImageHistoryList: Remove 'wpEditToken' parameter from the "revert" link for files

The action=revert page does not use this parameter at all. (It displays
a form with an entirely different token.) I think this has not been
needed since cf6dd13faca23af5b6e3188445b84e05d620d499 (r91284).

Change-Id: Ice5ecd2606a94a70321ede5304fee77fb1fb06c1

7 years agoMediaWikiServices: Import NoSuchServiceException
Sam Smith [Wed, 31 Aug 2016 10:46:02 +0000 (11:46 +0100)]
MediaWikiServices: Import NoSuchServiceException

NoSuchServiceException is in the MediaWiki\Services namespace. Since the
MediaWikiServices class is in the MediaWiki namespace, the

  catch ( NoSuchServiceException $e )

line added in Ifc587d61 will fail to catch any exception.

Co-Author: Paladox <thomasmulhall410@yahoo.com>
Bug: T143974
Change-Id: I903336c85c0bb9fb259f475f37959136e2ff7eca

7 years agoobjectcache: add and use adaptiveTTL() method
Aaron Schulz [Sun, 21 Aug 2016 21:53:55 +0000 (14:53 -0700)]
objectcache: add and use adaptiveTTL() method

* This better handles delayed/lost cache purges by
  having lower TTLs for entries that often changes.
* Use this for foreign upload description page caches,
  we purges are never received from the source wiki.
* Also use this for User and LocalFile cache TTLs.
* Also move the Database::getCacheSetOptions() call in
  User *before* doing the queries, which is preferred.
* Fixed some IDEA errors too, like the undeclared
  mApiBase field.

Change-Id: I70f8ebb29ac853c2a530d9eedb9e7facc1b7b710

7 years agoMerge "mw.loader: Use requestAnimationFrame for addEmbeddedCSS()"
jenkins-bot [Wed, 31 Aug 2016 01:53:58 +0000 (01:53 +0000)]
Merge "mw.loader: Use requestAnimationFrame for addEmbeddedCSS()"

7 years agoMerge "mw.loader: Make 'mwLoadEnd' less expensive with a single using()"
jenkins-bot [Wed, 31 Aug 2016 01:52:31 +0000 (01:52 +0000)]
Merge "mw.loader: Make 'mwLoadEnd' less expensive with a single using()"

7 years agomw.loader: Use requestAnimationFrame for addEmbeddedCSS()
Timo Tijhof [Tue, 30 Aug 2016 04:07:52 +0000 (21:07 -0700)]
mw.loader: Use requestAnimationFrame for addEmbeddedCSS()

setTimeout is fairly inefficient for this purpose as it tends to schedule for
further in the future than rAF would. And even then, it happens at a bad time
for the browser with regards to style changes.

Instead, use rAF, which typically executes earlier and at the point where the
browser is expecting style changes.

This makes top and bottom modules finish execution earlier by having their
styles applied sooner.

Change-Id: Ie4e7464aa811fa8ea4e4f115696f0bddbd28737b

7 years agomw.loader: Make 'mwLoadEnd' less expensive with a single using()
Timo Tijhof [Fri, 26 Aug 2016 04:51:01 +0000 (21:51 -0700)]
mw.loader: Make 'mwLoadEnd' less expensive with a single using()

20-30ms before this patch, ~2ms after this patch (MacBookPro, Chrome 52).

The creation of 100s of Deferred objects, $.when() tracking them
all, and bubbling up the completion took 20-30ms. This is quite
expensive. Optimise by using a single deferred first.
A module reaching state 'missing' or 'error' is very rare.

Change-Id: I90eea4bfe8fe6d85c395d9d0868bbde482c4a703

7 years agomw.Title: Correct handling of Unicode whitespace and bidi control characters
Bartosz Dziewoński [Wed, 24 Aug 2016 19:33:45 +0000 (21:33 +0200)]
mw.Title: Correct handling of Unicode whitespace and bidi control characters

MediaWiki titles may not contain Unicode bidi control characters, e.g.
U+200E LEFT-TO-RIGHT MARK. They are silently stripped and such a
title is considered valid.

MediaWiki titles may not contain any whitespace other than a regular
space. Most of them are silently replaced with a regular space and
such a title is considered valid, but there are some (e.g. the tab
character) which make the title invalid. I'm not sure if this is an
intentional behavior, but I added a test case to verify it.

Bug: T143759
Change-Id: If8fad1f896027c5d93a62b0785923a39136c6a36

7 years agoMerge "objectcache: Make SqlBagOStuff::waitForSlaves() no-op without slaves"
jenkins-bot [Tue, 30 Aug 2016 22:54:23 +0000 (22:54 +0000)]
Merge "objectcache: Make SqlBagOStuff::waitForSlaves() no-op without slaves"

7 years agoobjectcache: Make SqlBagOStuff::waitForSlaves() no-op without slaves
Aaron Schulz [Tue, 30 Aug 2016 22:32:09 +0000 (15:32 -0700)]
objectcache: Make SqlBagOStuff::waitForSlaves() no-op without slaves

Change-Id: Ibaa4745c18c6f4f66edb4c5f190196b575d3b738

7 years agoMerge "Add more estimation modes to pendingWriteQueryDuration()"
jenkins-bot [Tue, 30 Aug 2016 21:44:54 +0000 (21:44 +0000)]
Merge "Add more estimation modes to pendingWriteQueryDuration()"

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Tue, 30 Aug 2016 20:04:17 +0000 (22:04 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I197f28fb1bb4507234a7f534160f017db2476598

7 years agoMerge "Expand SessionManager / AuthManager documentation"
jenkins-bot [Tue, 30 Aug 2016 19:11:13 +0000 (19:11 +0000)]
Merge "Expand SessionManager / AuthManager documentation"

7 years agoExpand SessionManager / AuthManager documentation
Gergő Tisza [Sat, 27 Aug 2016 05:40:37 +0000 (05:40 +0000)]
Expand SessionManager / AuthManager documentation

Bug: T110628
Bug: T142154
Change-Id: Ib0a41f01b3d12267b2a94ea1375e6d13cacd2b69

7 years agoMerge "mw.api.messages: Allow passing extra parameters for the API call"
jenkins-bot [Tue, 30 Aug 2016 17:30:47 +0000 (17:30 +0000)]
Merge "mw.api.messages: Allow passing extra parameters for the API call"

7 years agomw.api.messages: Allow passing extra parameters for the API call
Bartosz Dziewoński [Tue, 30 Aug 2016 16:18:39 +0000 (18:18 +0200)]
mw.api.messages: Allow passing extra parameters for the API call

Mostly I want to pass `amenableparser: true`.

Bug: T144237
Change-Id: I7e1a52a59a25befe4edb7b4f531d60a2615e8f90

7 years agomediawiki.toc: Simplify function toggleToc call
Fomafix [Tue, 30 Aug 2016 10:37:41 +0000 (12:37 +0200)]
mediawiki.toc: Simplify function toggleToc call

Change-Id: Ib74b217a265cf17acf72cf8b75d5a751531755a0

7 years agoMerge "mediawiki.toc: Simplify ternary operator"
jenkins-bot [Tue, 30 Aug 2016 14:51:20 +0000 (14:51 +0000)]
Merge "mediawiki.toc: Simplify ternary operator"

7 years agoMerge "MediaWikiServices: Don't assume, that old and new instances contains the same...
jenkins-bot [Tue, 30 Aug 2016 14:31:14 +0000 (14:31 +0000)]
Merge "MediaWikiServices: Don't assume, that old and new instances contains the same services"

7 years agoMediaWikiServices: Don't assume, that old and new instances contains the same services
Florian Schmidt [Sun, 28 Aug 2016 16:33:40 +0000 (18:33 +0200)]
MediaWikiServices: Don't assume, that old and new instances contains the same services

As the services, that are registered in MediaWikiServices can be changed by
extensions using the MediaWikiServices hook, it's not save to assume, that
the first created instance of MediaWikiServices (which could be created before
any extension is loaded, e.g. in ExtensionRegistry) contains the same services
as a later created one (in the reset process of resetGlobalInstance). Doing this
could result in a NoSuchServiceException, if an extension registers new services,
which aren't registered before the extension is loaded (as, in the reset process,
MediaWikiServices tries to minimize the service instantiation cost by preserving
services, that can be preserved).

This patch adds a check, if a service is registered in the MediaWikiServices object
that should be reset, before the salvage-logic tries to fetch the services. If the
service object does not exist, it simply skips it, as it will simply instantiated
later.

Follow up: Ie2ca3ff99aa74fffa9eb6c8faccab857dc0874f7
Follow up: I2a26b6af07a48ad15414a8428daa9cfcfe02e933

Bug: T143974
Change-Id: Ifc587d6138ab565c2f38eb0805acf0dd0473d433

7 years agoRevert serie of "EditPage: Use context instead of globals"
Antoine Musso [Tue, 30 Aug 2016 12:46:38 +0000 (14:46 +0200)]
Revert serie of "EditPage: Use context instead of globals"

Reverts:

89cade EditPage: Use context instead of globals (4/4)
27fd110 EditPage: Use context instead of globals (3/4)
afa6307 EditPage: Use context instead of globals (2/4)
f2f8101 EditPage: Use context instead of globals (1/4)

LiquidThreads is still using globals when invoking EditPage. That can be
reproduced by attempting to reply to a message which eventually causes
EditPage::importFormData() to errors out with:

ErrorPageError from includes/EditPage.php:
The content format json is not supported by the content model wikitexte.

Bug: T143889
Change-Id: I593450971e4a4a31c88df49334859508d1fd006c

7 years agoRevert "EditPage: Use context instead of globals (1/4)"
Antoine Musso [Tue, 30 Aug 2016 12:36:43 +0000 (14:36 +0200)]
Revert "EditPage: Use context instead of globals (1/4)"

This reverts commit f2f810181aa4188053da2af94faa6e3bad33d1a3.

Change-Id: Ia0267204522168ba7e74f4a732af12da6113bf69

7 years agoRevert "EditPage: Use context instead of globals (2/4)"
Antoine Musso [Tue, 30 Aug 2016 12:36:46 +0000 (14:36 +0200)]
Revert "EditPage: Use context instead of globals (2/4)"

This reverts commit afa630749a393114a5df0921f75590a8ca189c91.

Change-Id: I721d0ecc5462fd17fd016f83471218a53cd0f75b

7 years agoRevert "EditPage: Use context instead of globals (3/4)"
Antoine Musso [Tue, 30 Aug 2016 12:36:47 +0000 (14:36 +0200)]
Revert "EditPage: Use context instead of globals (3/4)"

This reverts commit 27fd11095213eaf2b3b5d2e21a93b6ee03c3b004.

Change-Id: I23480a49d69fbede292a1d41f1c5e783b6366852

7 years agoRevert "EditPage: Use context instead of globals (4/4)"
Antoine Musso [Tue, 30 Aug 2016 12:36:48 +0000 (14:36 +0200)]
Revert "EditPage: Use context instead of globals (4/4)"

This reverts commit 589cadedf31787e75c9f83b3c4f05c79397dd4cc.

Change-Id: I4022ab93ca9bb3e41f1f563c4e919d8f3e4cb18f

7 years agomediawiki.toc: Simplify ternary operator
Fomafix [Tue, 30 Aug 2016 11:47:11 +0000 (13:47 +0200)]
mediawiki.toc: Simplify ternary operator

Change-Id: Ie315fb5c520c44e1f95bd96ec95bb46c09c93b36

7 years agoMerge "Invalidate cache when page language is changed"
jenkins-bot [Tue, 30 Aug 2016 06:07:33 +0000 (06:07 +0000)]
Merge "Invalidate cache when page language is changed"

7 years agoMerge "mw.widgets.CategoryCapsuleItemWidget: Handle titles not normalized in JS code"
jenkins-bot [Tue, 30 Aug 2016 02:03:42 +0000 (02:03 +0000)]
Merge "mw.widgets.CategoryCapsuleItemWidget: Handle titles not normalized in JS code"

7 years agoMerge "API: Warn when input parameters are normalized"
jenkins-bot [Tue, 30 Aug 2016 01:46:36 +0000 (01:46 +0000)]
Merge "API: Warn when input parameters are normalized"

7 years agoMerge "API: Use U+001F (Unit Separator) for separating multi-valued parameters"
jenkins-bot [Tue, 30 Aug 2016 01:45:03 +0000 (01:45 +0000)]
Merge "API: Use U+001F (Unit Separator) for separating multi-valued parameters"

7 years agomw.widgets.CategoryCapsuleItemWidget: Handle titles not normalized in JS code
Bartosz Dziewoński [Wed, 24 Aug 2016 20:21:42 +0000 (22:21 +0200)]
mw.widgets.CategoryCapsuleItemWidget: Handle titles not normalized in JS code

Bug: T139130
Change-Id: If20941fb381a01aab01b971e1093a53b76c96f66

7 years agoAdd more estimation modes to pendingWriteQueryDuration()
Aaron Schulz [Sat, 27 Aug 2016 10:57:26 +0000 (03:57 -0700)]
Add more estimation modes to pendingWriteQueryDuration()

* Use this to exclude some common cases of harmless queries that
  happen to block on row-level locks for a long time. This does
  not apply to UPDATE/DELETE however, due to the ambiguity of
  time spent scanning vs locking.
* Update commitMasterChanges() and JobRunner to use the new
  mode to avoid pointless rollback or lag checks.

Change-Id: Ifc2743f2d8cd109840c45cda5028fbb4df55d231

7 years agoMerge "Include PRESEND updates in ChronologyProtector positions"
jenkins-bot [Tue, 30 Aug 2016 01:31:47 +0000 (01:31 +0000)]
Merge "Include PRESEND updates in ChronologyProtector positions"

7 years agoMerge "resourceloader: Create unit tests for ResourceLoaderContext"
jenkins-bot [Tue, 30 Aug 2016 00:27:41 +0000 (00:27 +0000)]
Merge "resourceloader: Create unit tests for ResourceLoaderContext"

7 years agoMerge "Fixing dry-run logic in updateCollation.php"
jenkins-bot [Tue, 30 Aug 2016 00:13:47 +0000 (00:13 +0000)]
Merge "Fixing dry-run logic in updateCollation.php"

7 years agoMerge "Move some DB error classes with the rest as type DBUnexpectedError"
jenkins-bot [Tue, 30 Aug 2016 00:11:43 +0000 (00:11 +0000)]
Merge "Move some DB error classes with the rest as type DBUnexpectedError"

7 years agoMerge "LinksUpdate: Add functions returning changed page properties"
jenkins-bot [Tue, 30 Aug 2016 00:04:27 +0000 (00:04 +0000)]
Merge "LinksUpdate: Add functions returning changed page properties"

7 years agoresourceloader: Create unit tests for ResourceLoaderContext
Timo Tijhof [Mon, 29 Aug 2016 23:35:55 +0000 (16:35 -0700)]
resourceloader: Create unit tests for ResourceLoaderContext

* Fix up one last use of global config vars in this class.
  Other places in this class already used $rl->getConfig().
  This way we don't inherit all of MediaWikiTestCase.

* Add unit tests covering all of ResourceLoaderContext
  except expandModuleNames and getImageObj (tested in better
  places already with the right @covers).

* Increase coverage for expandModuleNames(), add missing case
  of when modules are not in alphabetical order.

Change-Id: Id19b084d37a6c3a77b36e03509adffb6b156fee1

7 years agoLinksUpdate: Add functions returning changed page properties
cenarium [Thu, 28 Jan 2016 18:58:44 +0000 (19:58 +0100)]
LinksUpdate: Add functions returning changed page properties

This adds getAddedProperties and getRemovedProperties functions
to LinksUpdate. They are available only after the update, so for
extensions in the LinksUpdateComplete hook. This is useful for
example if an extension caches a page property; if the property
gets changed it may want to purge the cache.

This is similar to the getAddedLinks and getRemovedLinks
functions.

Change-Id: I0c73b3d181f32502da75687857ae9aeff731f559

7 years agoFixing dry-run logic in updateCollation.php
Kaldari [Mon, 29 Aug 2016 23:29:24 +0000 (16:29 -0700)]
Fixing dry-run logic in updateCollation.php

Currently if you run updateCollation.php in dry-run mode, it ignores
the other parameters and doesn't give you a row estimate. Now it
will behave the same as an actual run (just without making any
changes to the database).

Change-Id: I25a9751d8ab7554e7975e5f08122dd1ddaaf40a7

7 years agoMerge "Make WikiPage::doDeleteArticle more robust"
jenkins-bot [Mon, 29 Aug 2016 23:28:12 +0000 (23:28 +0000)]
Merge "Make WikiPage::doDeleteArticle more robust"

7 years agoMove some DB error classes with the rest as type DBUnexpectedError
Aaron Schulz [Mon, 29 Aug 2016 22:48:01 +0000 (15:48 -0700)]
Move some DB error classes with the rest as type DBUnexpectedError

Change-Id: I97d61d32495e6d88ce274772369390c76d7ff3c4

7 years agoMake WikiPage::doDeleteArticle more robust
daniel [Sat, 25 Jun 2016 16:25:13 +0000 (18:25 +0200)]
Make WikiPage::doDeleteArticle more robust

When it becomes impossible to load the content of a page due to some
error or misconfiguration, we still want to be able to delete that
page. This change makes WikiPage::doDeleteArticle more robust by catching
any exceptions that may be thrown while trying to load the page content
during the deletion process.

See T128466 for context.

Change-Id: I19f2d16850a3c1af5b504a70a27b9bf1330bc68d

7 years agoMerge "Floor slave lag before display"
jenkins-bot [Mon, 29 Aug 2016 23:16:54 +0000 (23:16 +0000)]
Merge "Floor slave lag before display"

7 years agoMerge "resourceloader: Add test coverage for DerivativeResourceLoaderContext"
jenkins-bot [Mon, 29 Aug 2016 23:00:46 +0000 (23:00 +0000)]
Merge "resourceloader: Add test coverage for DerivativeResourceLoaderContext"

7 years agoMerge "Use DB_SLAVE in TemporaryPasswordPrimaryAuthenticationProvider"
jenkins-bot [Mon, 29 Aug 2016 22:52:09 +0000 (22:52 +0000)]
Merge "Use DB_SLAVE in TemporaryPasswordPrimaryAuthenticationProvider"

7 years agodatabase: Clean up profiling code in DatabaseBase
Aaron Schulz [Mon, 29 Aug 2016 17:41:59 +0000 (10:41 -0700)]
database: Clean up profiling code in DatabaseBase

This cuts down on conditionals and ScopedCallback use.

Change-Id: Ie478c613b062e45120cdd626f9fb9de09594c638

7 years agoresourceloader: Add test coverage for DerivativeResourceLoaderContext
Timo Tijhof [Mon, 29 Aug 2016 21:34:57 +0000 (14:34 -0700)]
resourceloader: Add test coverage for DerivativeResourceLoaderContext

* Re-order method tests to match source class.
* Add @covers.
* Add tests to make coverage 100%.

Change-Id: I46bdb66bc08120a82d44208a39d2dd6b7de18de1

7 years agoMove HTTP 304 check from performRequest to ViewAction
Aaron Schulz [Thu, 25 Aug 2016 00:19:58 +0000 (17:19 -0700)]
Move HTTP 304 check from performRequest to ViewAction

* Follow-up to 8b141886edebc
* The method is now called after the setCdnMaxage() call
  in performAction.
* Allow any CDN urls for the title now, check $wgDebugToolbar,
  and allows caching redirects. The multi-step redirect case does
  not cache however, for simplicity.
* Removed now-unused code in Article that calculated $timestamp.

Change-Id: Ic4f4e3a79d7d386c2f15ca5b11dddf5c57ff9e9f

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Mon, 29 Aug 2016 19:58:25 +0000 (21:58 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I1c626bebfe8884c968a8e76e151496f224f90cea

7 years agoMerge "mediawiki.api.messages: Fix typo in comments"
jenkins-bot [Mon, 29 Aug 2016 18:57:31 +0000 (18:57 +0000)]
Merge "mediawiki.api.messages: Fix typo in comments"

7 years agomediawiki.api.messages: Fix typo in comments
Bartosz Dziewoński [Mon, 29 Aug 2016 17:06:02 +0000 (19:06 +0200)]
mediawiki.api.messages: Fix typo in comments

Change-Id: I2d51a982408f54ea62e38d7b3da99af4b73541c6

7 years agoRename EditButtonPublishNotSave to EditSubmitButtonLabelPublish
James D. Forrester [Mon, 29 Aug 2016 17:44:44 +0000 (10:44 -0700)]
Rename EditButtonPublishNotSave to EditSubmitButtonLabelPublish

Per legoktm.

Change-Id: I4fbe54876095378a476399bf5e336c8df3e91e14

7 years agoMerge "Directly use getSession for specialPreferencesSaveSuccess"
jenkins-bot [Mon, 29 Aug 2016 16:54:15 +0000 (16:54 +0000)]
Merge "Directly use getSession for specialPreferencesSaveSuccess"

7 years agoMerge "Fix shutdown() code duplication in LBFactory"
jenkins-bot [Mon, 29 Aug 2016 16:47:04 +0000 (16:47 +0000)]
Merge "Fix shutdown() code duplication in LBFactory"

7 years agoMerge "Remove Block::purgeExpired() call from block query API"
jenkins-bot [Mon, 29 Aug 2016 16:30:15 +0000 (16:30 +0000)]
Merge "Remove Block::purgeExpired() call from block query API"

7 years agoRemove Block::purgeExpired() call from block query API
Aaron Schulz [Sun, 28 Aug 2016 18:37:39 +0000 (11:37 -0700)]
Remove Block::purgeExpired() call from block query API

This avoids master queries on HTTP GET. Filter out rows on the
fly and allow for pruning to only happen when blocks do.

Change-Id: Idd25b2f8a789ba191fde87e997910e78d67c7021

7 years agoFix shutdown() code duplication in LBFactory
Aaron Schulz [Mon, 29 Aug 2016 16:11:02 +0000 (09:11 -0700)]
Fix shutdown() code duplication in LBFactory

Merge duplicate shutdown() methods from LBFactory subclasses
to the base class, as cronProt is also set there too.

Change-Id: I4050b3469f61b1f4173d5841ff2497f3f30e1382

7 years agoMerge "Set the WRITE_SYNC flag for SessionBackend writes"
jenkins-bot [Mon, 29 Aug 2016 16:05:47 +0000 (16:05 +0000)]
Merge "Set the WRITE_SYNC flag for SessionBackend writes"

7 years agoUse DB_SLAVE in TemporaryPasswordPrimaryAuthenticationProvider
Aaron Schulz [Sun, 28 Aug 2016 19:10:14 +0000 (12:10 -0700)]
Use DB_SLAVE in TemporaryPasswordPrimaryAuthenticationProvider

Barring ChronologyProtector failure (which itself falls back
to waitForReplication) on account creation, this should be fine.

Change-Id: I94be86c8f56e9e98a9d06814b33a9f08a9228db6

7 years agoAPI: Warn when input parameters are normalized
Brad Jorsch [Wed, 24 Aug 2016 18:07:43 +0000 (14:07 -0400)]
API: Warn when input parameters are normalized

If a client submits data that is not NFC-normalized Unicode or that
contains C0 controls other than HT, LF, and CR, it gets normalized before
the API ever sees it. Which can lead to difficult-to-handle bugs when,
for example, a title is subject to normalization so the client can't
find the specific title it submitted anywhere in the response (T139130).

This patch does two things:
* Detects when normalization was applied to an input value (at the
  MediaWiki level, anyway; if PHP or earlier does it we're just out of
  luck) and add a warning to that effect.
* For ApiPageSet's 'titles' parameter, split into the individual titles
  and add them to the 'normalized' list in the response. This requires
  encoding the pre-normalized strings to avoid ApiResult's own
  normalization.

Bug: T29849
Bug: T144071
Change-Id: I215fd3edd7a5e1b45292e60768bf6dd5ad7f34de

7 years agoAPI: Use U+001F (Unit Separator) for separating multi-valued parameters
Brad Jorsch [Tue, 16 Aug 2016 20:36:27 +0000 (16:36 -0400)]
API: Use U+001F (Unit Separator) for separating multi-valued parameters

When a multi-valued parameter's value begins with U+001F, the values
will be split on that character instead of pipes. This will be useful
for things such as action=options&change= or meta=allmessages&amargs=.
Since MediaWiki doesn't otherwise accept C0 control characters
(WebRequest::getVal() replaces them with �), there's no possibility that
this will conflict with a literal use of U+001F.

Special:ApiSandbox and mw.Api are updated to make use of this, with the
latter having an option to disable the behavior in case something is
depending on [ 'foo', 'bar|baz' ] turning into 'foo|bar|baz'.

Pipe is still used as the separator when the value doesn't begin with
U+001F, and will be forever since it's generally more human-friendly and
is needed for backwards compatibility with basically every API client in
existence. The requirement that the value begin with U+001F, rather than
simply contain U+001F, is to avoid clients having to somehow
special-case "param=foo|bar" where that's intended to be a single value
"foo|bar" rather than two values "foo" and "bar".

Bug: T141960
Change-Id: I45f69997667b48887a2b67e93906364a652ace5a

7 years agoMerge "ApiResult: Remove double space in error message"
jenkins-bot [Mon, 29 Aug 2016 14:47:46 +0000 (14:47 +0000)]
Merge "ApiResult: Remove double space in error message"

7 years agoApiResult: Remove double space in error message
Bartosz Dziewoński [Mon, 29 Aug 2016 14:02:04 +0000 (16:02 +0200)]
ApiResult: Remove double space in error message

Change-Id: I5888d617ab9aebe5ae1fe4da6873639a81f60fc3

7 years agoAdd notes in release notes for supporting xiz and xit in time parser function
Amir Sarabadani [Mon, 29 Aug 2016 10:17:08 +0000 (14:47 +0430)]
Add notes in release notes for supporting xiz and xit in time parser function

Change-Id: I0bec049a23337933a4a2c06b72260d7399c7cd4c

7 years agoMerge "introduce {{#time: xiz}} for days passed in the year"
jenkins-bot [Mon, 29 Aug 2016 06:11:40 +0000 (06:11 +0000)]
Merge "introduce {{#time: xiz}} for days passed in the year"

7 years agoDirectly use getSession for specialPreferencesSaveSuccess
Fomafix [Mon, 22 Aug 2016 04:36:09 +0000 (06:36 +0200)]
Directly use getSession for specialPreferencesSaveSuccess

Change-Id: If9017f6c42f4c8f697504e3b92cee8bfb907b8e7

7 years agoInclude PRESEND updates in ChronologyProtector positions
Aaron Schulz [Mon, 29 Aug 2016 00:01:55 +0000 (17:01 -0700)]
Include PRESEND updates in ChronologyProtector positions

This updates are PRESEND for reason, so users should see them
on the next page view. Otherwise, they would be POSTSEND.

Change-Id: I533de550f6dd3e4b75507c2d25b1a05f7ac1301d

7 years agoMerge "Memcached PECL: Allow using binary protocol"
jenkins-bot [Sun, 28 Aug 2016 21:49:47 +0000 (21:49 +0000)]
Merge "Memcached PECL: Allow using binary protocol"

7 years agoSet the WRITE_SYNC flag for SessionBackend writes
Aaron Schulz [Sun, 28 Aug 2016 20:44:04 +0000 (13:44 -0700)]
Set the WRITE_SYNC flag for SessionBackend writes

Session writes should be seen in all datacenters so users do not
randomly end up logged on the next page view on a GET request
after login. Sticky DC cookies help, but not for cross domain
redirects or page views.

Change-Id: Id533fa1b867680e6386060efa4878ad1b4638c18

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Sun, 28 Aug 2016 20:02:22 +0000 (22:02 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: Ic246c3d4e15143a000363bcfb64921cc88e1ae58

7 years agoMerge "Fix database class doc typos"
jenkins-bot [Sun, 28 Aug 2016 05:24:45 +0000 (05:24 +0000)]
Merge "Fix database class doc typos"

7 years agoFix database class doc typos
Aaron Schulz [Sun, 28 Aug 2016 02:39:28 +0000 (19:39 -0700)]
Fix database class doc typos

Change-Id: I3e8c4e31326cb4f1a6b427348b42975fba86e62b

7 years agoMerge "mw.loader: Minor clean up and optimisations"
jenkins-bot [Sun, 28 Aug 2016 02:16:06 +0000 (02:16 +0000)]
Merge "mw.loader: Minor clean up and optimisations"

7 years agoMerge "Add new UsersPagerDoBatchLookups hook to allow for extensions to modify UsersP...
jenkins-bot [Sat, 27 Aug 2016 22:05:43 +0000 (22:05 +0000)]
Merge "Add new UsersPagerDoBatchLookups hook to allow for extensions to modify UsersPager::doBatchLookup()'s rigid behavior"

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Sat, 27 Aug 2016 20:50:29 +0000 (22:50 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I430efe1c74261562782b5814c0ed609a340ff88c

7 years agoMerge "Enable $wgResourceLoaderStorageEnabled by default"
jenkins-bot [Sat, 27 Aug 2016 19:22:27 +0000 (19:22 +0000)]
Merge "Enable $wgResourceLoaderStorageEnabled by default"

7 years agoInvalidate cache when page language is changed
Glaisher [Sat, 27 Aug 2016 17:18:12 +0000 (22:18 +0500)]
Invalidate cache when page language is changed

So that page language-based stuff like magic words are updated.

Change-Id: I840973906b62bfdb18661e61ad053c8eb438bf01

7 years agoDo not localize content model name inside of english exception messages
Tpt [Sat, 27 Aug 2016 09:03:18 +0000 (11:03 +0200)]
Do not localize content model name inside of english exception messages

Bug: T143889
Change-Id: I2d8004123ca6ae94219bd7880beb1c274ce13417

7 years agoMerge "API: Some raw message cleanup"
jenkins-bot [Sat, 27 Aug 2016 01:18:10 +0000 (01:18 +0000)]
Merge "API: Some raw message cleanup"

7 years agoMerge "Rollback: Catch error when unable to load latest revision data"
jenkins-bot [Sat, 27 Aug 2016 00:30:06 +0000 (00:30 +0000)]
Merge "Rollback: Catch error when unable to load latest revision data"

7 years agoMerge "Linker: Get rid of "shortcuts" in image linking functions"
jenkins-bot [Sat, 27 Aug 2016 00:25:06 +0000 (00:25 +0000)]
Merge "Linker: Get rid of "shortcuts" in image linking functions"

7 years agoRollback: Catch error when unable to load latest revision data
Chad Horohoe [Sat, 27 Aug 2016 00:01:53 +0000 (17:01 -0700)]
Rollback: Catch error when unable to load latest revision data

Ideally this never happens, but it can, so fail gracefully instead
of just throwing a 'call to a member function on non-object' message

Change-Id: Iac8be9c7994aa3e74ed3c0eecff211524037165e

7 years agomw.loader: Minor clean up and optimisations
Timo Tijhof [Thu, 25 Aug 2016 23:08:56 +0000 (16:08 -0700)]
mw.loader: Minor clean up and optimisations

* mw.loader.state: Simplify code by removing redundant branch that could set
  the value to what it already was. Also remove the condition for it since
  re-setting it should never happen in practice.
  If it does happen, it's a harmless no-op.

* mw.loader.store.set: Document use cases for descriptor being partial.
  On a most page views, this branch runs for 'site.styles', 'json', 'user',
  'dom-level2-shim', 'mediawiki.hidpi', 'user.options', and 'user.tokens'.
  Aside from group=user modules, the others are skipped or style modules.

* register: Make faster and reduce GC overhead
  (MacBookPro, Chrome canary 52, Vagrant, 566 registered modules)
  Measured using Timeline (JS Profile) and Profile (Allocation Profile).

  - Use typeof instead of isFunction().
  - In resolveIndexedDependencies:
    - Use a for-loop instead of $.each(). This uncovered a JSHint warning for
      making $.map() functions in a loop. Move the function out and re-use it.
    - Use a for-loop instead of $.map().
  - Don't create an empty dependencies array in the registry only to
    dereference it in the next statement.

  Time for register() down from 5-10ms to 3-4ms.
  Memory for register() down
   from 153KB (88% in register, 12% in resolveIndexedDependencies/each/map)
   to 120KB (100% in register, no mention of resolveIndexedDependencies)
  GC down from 350KB to 240KB.

* Remove use of isFunction(). We're not interested in its edge cases of
  native functions in old IE and regex false-positive in Android 2.3.
  For plain user-specified functions, typeof will return 'function'
  in all supported browsers.

Change-Id: I43fc7c7f54d0c279b659d6fddd21673de48f4bc2

7 years agoMerge "Make database ping() method avoid starting transactions"
jenkins-bot [Fri, 26 Aug 2016 20:15:52 +0000 (20:15 +0000)]
Merge "Make database ping() method avoid starting transactions"

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Fri, 26 Aug 2016 19:56:23 +0000 (21:56 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I3b13581197c9b68ffa28e156f47311b6a26d741d

7 years agoMerge "resources: Deprecate module "jquery.appear""
jenkins-bot [Fri, 26 Aug 2016 19:48:49 +0000 (19:48 +0000)]
Merge "resources: Deprecate module "jquery.appear""

7 years agoMake database ping() method avoid starting transactions
Aaron Schulz [Fri, 26 Aug 2016 05:20:23 +0000 (22:20 -0700)]
Make database ping() method avoid starting transactions

Also use the $ignoreErrors flag to simplify the code.

Change-Id: Ieb685366b35487abcd618eb73cf67f4c266a70c7

7 years agoMerge "Fix docs for the HtmlPageLinkRenderer hooks"
jenkins-bot [Fri, 26 Aug 2016 19:07:02 +0000 (19:07 +0000)]
Merge "Fix docs for the HtmlPageLinkRenderer hooks"

7 years agoFix docs for the HtmlPageLinkRenderer hooks
Marius Hoch [Fri, 26 Aug 2016 01:58:59 +0000 (03:58 +0200)]
Fix docs for the HtmlPageLinkRenderer hooks

The $text parameter wasn't correctly documented here,
as far as I can tell.

Change-Id: I335d1a59739d80f9f904872e3135f0aae7535956

7 years agoMerge "ApiUpload: Better handle unreasonably large metadata in 'imageinfo'"
jenkins-bot [Fri, 26 Aug 2016 17:02:32 +0000 (17:02 +0000)]
Merge "ApiUpload: Better handle unreasonably large metadata in 'imageinfo'"

7 years agoMerge "Clean up array() syntax in docs, part IV"
jenkins-bot [Fri, 26 Aug 2016 16:49:58 +0000 (16:49 +0000)]
Merge "Clean up array() syntax in docs, part IV"

7 years agoApiUpload: Better handle unreasonably large metadata in 'imageinfo'
Bartosz Dziewoński [Fri, 26 Aug 2016 13:22:09 +0000 (15:22 +0200)]
ApiUpload: Better handle unreasonably large metadata in 'imageinfo'

Bug: T143993
Change-Id: I1fcdbca9981dd034572eeb32070d574cf97a132f

7 years agointroduce {{#time: xiz}} for days passed in the year
Amir Sarabadani [Fri, 26 Aug 2016 14:08:04 +0000 (18:38 +0430)]
introduce {{#time: xiz}} for days passed in the year

Discussed in the community

Change-Id: I4d5f638d7f0635df2a0a253a3b3bfe278a0aed0e

7 years agoClean up array() syntax in docs, part IV
Amir Sarabadani [Fri, 26 Aug 2016 11:36:58 +0000 (16:06 +0430)]
Clean up array() syntax in docs, part IV

Change-Id: If626409a93d31bf90c054c9bf7ba44a78ea9a621

7 years agoRemove patch-pl-tl-il-unique.sql
Kevin Israel [Fri, 26 Aug 2016 09:09:12 +0000 (05:09 -0400)]
Remove patch-pl-tl-il-unique.sql

In 1.24 (b8c038f6784ef082), this update from 1.15 (see T18645,
640a6d311e91ccdc) was undone in tables.sql. However, it was not
removed from MysqlUpdater, so update.php would still make the
indices UNIQUE, even when run on a new MediaWiki installation.

In its place, added patch-pl-tl-il-nonunique.sql, which recreates
the indices to match the current definitions from tables.sql.

Bug: T78513
Change-Id: Ic82ca06c8e7051bcd1e0a2a3d5d251e297a9142f

7 years agoMerge "SQLite syntax checker: Fix support for multiple files"
jenkins-bot [Fri, 26 Aug 2016 03:37:27 +0000 (03:37 +0000)]
Merge "SQLite syntax checker: Fix support for multiple files"

7 years agoresources: Deprecate module "jquery.appear"
jdlrobson [Mon, 15 Aug 2016 22:22:20 +0000 (16:22 -0600)]
resources: Deprecate module "jquery.appear"

Bug: T143965
Change-Id: Ib610a624cdce082def3de5efc30ed8721432a7f8

7 years agojquery.ui.position: Mark as deprecated
Jforrester [Fri, 26 Aug 2016 01:28:28 +0000 (01:28 +0000)]
jquery.ui.position: Mark as deprecated

Bug: T142418
Change-Id: Ie6a65e8cfb69f9858c0b04d6f24c307ffcebb5a5