lhc/web/wiklou.git
5 years agoMerge "Fix some warnings from phan-taint-check"
jenkins-bot [Thu, 30 Aug 2018 02:54:03 +0000 (02:54 +0000)]
Merge "Fix some warnings from phan-taint-check"

5 years agoMerge "EditPage: Allow summary=0 in URL parameter"
jenkins-bot [Thu, 30 Aug 2018 02:43:59 +0000 (02:43 +0000)]
Merge "EditPage: Allow summary=0 in URL parameter"

5 years agoMerge "resourceloader: Refuse to preview content with </script>"
jenkins-bot [Thu, 30 Aug 2018 01:01:13 +0000 (01:01 +0000)]
Merge "resourceloader: Refuse to preview content with </script>"

5 years agoMerge "Html: Reject </script> from inlineScript() and leave rest unescaped"
jenkins-bot [Thu, 30 Aug 2018 01:01:04 +0000 (01:01 +0000)]
Merge "Html: Reject </script> from inlineScript() and leave rest unescaped"

5 years agoresources: Deprecate jquery.localize, long-replaced by jquery.i18n
James D. Forrester [Wed, 29 Aug 2018 23:31:09 +0000 (16:31 -0700)]
resources: Deprecate jquery.localize, long-replaced by jquery.i18n

Bug: T202154
Change-Id: I2548880987145d41f6a0c6fa7466fb6405e1c5a1

5 years agoresourceloader: Refuse to preview content with </script>
Timo Tijhof [Mon, 20 Aug 2018 00:14:46 +0000 (01:14 +0100)]
resourceloader: Refuse to preview content with </script>

Bug: T200506
Change-Id: I4ab5fbb0f5413aad24360169ba635672ce8d9c8e

5 years agoHtml: Reject </script> from inlineScript() and leave rest unescaped
Timo Tijhof [Mon, 20 Aug 2018 00:42:15 +0000 (01:42 +0100)]
Html: Reject </script> from inlineScript() and leave rest unescaped

There are three problems with the CDATA approach:

1. It doesn't work.

   HTML5 already interprets the contents of <script> tags as CDATA,
   which means escaping of characters like & is not needed. In fact,
   in HTML5 mode, a plain script tag with <script>0&amp;1;</script>
   would be a syntax error. Indicating it is not interpreted as
   text, but as CDATA. Effectively, the only thing an HTML parser
   looks for is </script>.

   And that's exactly the problem. Producing an inline script
   containing the characters "</string>" for legitimate reasons,
   is currently broken.
   No alternate wrapping or setting can make it work, either.

   See also:
   https://people.wikimedia.org/~krinkle/200506-html-inlinescript.html
   which contains:

   <script>/*<![CDATA[*/
   if (true && true) {
     console.log('This is a <script></script> tag (original)');
   }
   /*]]>*/</script>

   In a browser, the script is terminated by the first "</script>",
   leaving the code unfinished, throwing a SyntaxError, and outputting
   the rest of the script as plain text on the page.

2. CDATA is only for XML mode, whereas MediaWiki does not support
   the XML/XHTML output mode (since MediaWiki 1.22). Instead, we only
   output HTML (5). Code that does need to produce XML, should use the
   class from Xml.php instead.

3. It gives a false sense of security.

We could just remove the CDATA code as-is and that in itself would be an
improvement per point 2 and 3, and would break nothing per point 1.

However, this commit attempts to address the underlying bug by rejecting
the characters "</script>" from input. If this is needed in a literal,
it is the responsibility of the caller to escape it in a way that is
appropiate for how it is used (string, comment, regex, etc.).

There are two ways this can be used currently in core:

* User input as exported through JSON (e.g. mw.config, or mw.messages).
  This is already fine as both FormatJson::encode and json_encode handle
  escape either < or / in the string by default already.

* Previews of edits to user scripts. This is currently already broken and
  causes the script to end early and produce arbitrary HTML on the page.
  This commit limits the impact by refusing to output such script in a
  broken way. I will further address that use case in a follow-up.

Bug: T200506
Change-Id: I67ceb34eabf2f62fd3f3841b8f1459289fad28fb

5 years agoMerge "jobqueue: Use explicit retry when refreshLinks can't get a lock"
jenkins-bot [Wed, 29 Aug 2018 21:49:35 +0000 (21:49 +0000)]
Merge "jobqueue: Use explicit retry when refreshLinks can't get a lock"

5 years agoMerge "Add code to read from ct_tag_id in ChangeTags"
jenkins-bot [Wed, 29 Aug 2018 21:49:29 +0000 (21:49 +0000)]
Merge "Add code to read from ct_tag_id in ChangeTags"

5 years agoMerge "HTMLForm: Deprecate parameters 'notice', 'notice-messages', 'notice-message'"
jenkins-bot [Wed, 29 Aug 2018 20:42:15 +0000 (20:42 +0000)]
Merge "HTMLForm: Deprecate parameters 'notice', 'notice-messages', 'notice-message'"

5 years agoMerge "sitemaps: absolute URL for sitemaps"
jenkins-bot [Wed, 29 Aug 2018 20:37:32 +0000 (20:37 +0000)]
Merge "sitemaps: absolute URL for sitemaps"

5 years agositemaps: absolute URL for sitemaps
Ian Marlier [Wed, 29 Aug 2018 18:02:23 +0000 (14:02 -0400)]
sitemaps: absolute URL for sitemaps

Google, at least, considers sitemap indexes that provide relative URLs
as being broken.

Bug: T202321
Change-Id: I5509be4b165eea9eca36e3f4975f87285ef87911

5 years agoHTMLForm: Deprecate parameters 'notice', 'notice-messages', 'notice-message'
Bartosz Dziewoński [Fri, 17 Aug 2018 21:04:57 +0000 (23:04 +0200)]
HTMLForm: Deprecate parameters 'notice', 'notice-messages', 'notice-message'

Bug: T197179
Change-Id: I603436e0720fdc0f08f35f3c0630b79865a9c82a

5 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Wed, 29 Aug 2018 19:56:11 +0000 (21:56 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I524cbcfe3d8d65c89ba38d60f7320304316ceede

5 years agoAdd code to read from ct_tag_id in ChangeTags
Amir Sarabadani [Sat, 11 Aug 2018 18:34:27 +0000 (20:34 +0200)]
Add code to read from ct_tag_id in ChangeTags

Bug: T194162
Change-Id: I6c9e0c94cdd46fe46ccaf7feb78889f4ab5995f2

5 years agoMerge "Apply content wrapping in ParserOutput::getText()"
jenkins-bot [Wed, 29 Aug 2018 16:25:22 +0000 (16:25 +0000)]
Merge "Apply content wrapping in ParserOutput::getText()"

5 years agoMerge "Add tests for article viewing"
jenkins-bot [Wed, 29 Aug 2018 15:29:21 +0000 (15:29 +0000)]
Merge "Add tests for article viewing"

5 years agoApply content wrapping in ParserOutput::getText()
daniel [Tue, 28 Aug 2018 16:48:10 +0000 (18:48 +0200)]
Apply content wrapping in ParserOutput::getText()

Instead of applying wrapping the the parser and unwrapping in
ParserOutput::getText(), turn this around and apply wrapping in getText(),
and only if desired.

This avoids search&replace logic for unwrapping, and it also makes it a lot
easier to merge the output of multiple slots for MCR output.

This changes behavior in two hopefully irrelevant ways:
1) the limit report comments will be inside the wrapper div, instead of
following it.
2) if HTML with a wrapper div is explicitly injected into a ParserOutput
object, it will not be possible to unwrap the text.

Bug: T174035
Change-Id: I1641b7995af9bd297f1acd610d583fbf874f34e0

5 years agoMerge "Use "break" instead of "continue""
jenkins-bot [Wed, 29 Aug 2018 13:07:00 +0000 (13:07 +0000)]
Merge "Use "break" instead of "continue""

5 years agoMerge "resourceloader: Remove unused static SkinModule::getLogo method"
jenkins-bot [Wed, 29 Aug 2018 10:34:52 +0000 (10:34 +0000)]
Merge "resourceloader: Remove unused static SkinModule::getLogo method"

5 years agoMerge "Install giorgiosironi/eris as require-dev"
jenkins-bot [Wed, 29 Aug 2018 10:06:07 +0000 (10:06 +0000)]
Merge "Install giorgiosironi/eris as require-dev"

5 years agoMerge "resourceloader: Audit use of JSON encoding and use json_encode directly"
jenkins-bot [Wed, 29 Aug 2018 01:22:22 +0000 (01:22 +0000)]
Merge "resourceloader: Audit use of JSON encoding and use json_encode directly"

5 years agoMerge "Remove support for StartProfiler.php"
jenkins-bot [Wed, 29 Aug 2018 01:16:33 +0000 (01:16 +0000)]
Merge "Remove support for StartProfiler.php"

5 years agoresourceloader: Audit use of JSON encoding and use json_encode directly
Timo Tijhof [Thu, 16 Aug 2018 19:48:59 +0000 (20:48 +0100)]
resourceloader: Audit use of JSON encoding and use json_encode directly

* Remove use of MediaWiki's FormatJson class. Ref T32956.

* FormatJson::decode() was a direct alias of json_decode.

* FormatJson::encode() is a wrapper for json_encode that
  sets `JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP`
  by default, plus a boolean parameter to add JSON_PRETTY_PRINT.

  Instead, use json_encode() directly. By default json_encode() escapes
  slashes and non-ASCII unicode.

* Audit our uses of JSON encoding, document their needs, and set flags
  as needed.

* Remove $mapToJson abstraction from ResourceLoaderStartUpModule.

* Always pretty-print the list of module names in the error message,
  regardless of debug mode.

* Remove hacky indentation-adder from ResourceLoaderStartUpModule.
  This was relying on there not being line breaks in the json output
  outside debug mode, and adding a level of indentation to roughly
  match the code in the JSON is substituted. This didn't match and
  just generally doesn't seem worth it.

Change-Id: I3e09ddeb4d53c8980195c1855303c0ee25bd4c20

5 years agoMerge "resourceloader: Move logo preload from OutputPage to SkinModule"
jenkins-bot [Tue, 28 Aug 2018 23:07:00 +0000 (23:07 +0000)]
Merge "resourceloader: Move logo preload from OutputPage to SkinModule"

5 years agoresourceloader: Remove unused static SkinModule::getLogo method
Timo Tijhof [Mon, 20 Aug 2018 23:58:41 +0000 (00:58 +0100)]
resourceloader: Remove unused static SkinModule::getLogo method

This existed for internal use by OutputPage, which is no longer
the case as of I11b390f2e4f5e7db.

Also move the unit tests from OutputPageTest,
to ResourceLoaderSkinModuleTest.

Change-Id: I8b23f976f5f89b1005b387a827f75031f5c96141

5 years agoMerge "resourceloader: Remove checkCssHandles for modules without styles"
jenkins-bot [Tue, 28 Aug 2018 21:55:00 +0000 (21:55 +0000)]
Merge "resourceloader: Remove checkCssHandles for modules without styles"

5 years agoMerge "Notifications: Note that the ID is unnecessary and deprecated"
jenkins-bot [Tue, 28 Aug 2018 21:44:31 +0000 (21:44 +0000)]
Merge "Notifications: Note that the ID is unnecessary and deprecated"

5 years agojobqueue: Use explicit retry when refreshLinks can't get a lock
Timo Tijhof [Tue, 28 Aug 2018 21:14:25 +0000 (22:14 +0100)]
jobqueue: Use explicit retry when refreshLinks can't get a lock

While RefreshLinksJob is de-duplicated by page-id, it is possible
for two jobs to run for the same page ID if the second one was queued
after the first one started running. In that case they the newer
one must not be skipped or ignored because it will have newer
information to record to the database, but it also has no way
to stop the old one, and we can't run them concurrently.

Instead of letting the lock exception mark the job as error,
making it implicitly retry, do this more explicitly, which avoids
logspam.

Bug: T170596
Co-Authored-By: Aaron Schulz <aschulz@wikimedia.org>
Change-Id: Id2852d73d00daf83f72cf5ff778c638083f5fc73

5 years agoMerge "maintenance: Implement 'file' type and use for jquery and qunitjs"
jenkins-bot [Tue, 28 Aug 2018 20:30:02 +0000 (20:30 +0000)]
Merge "maintenance: Implement 'file' type and use for jquery and qunitjs"

5 years agoMerge "maintenance: Add 'verify' action to manageForeignResources.php"
jenkins-bot [Tue, 28 Aug 2018 20:25:12 +0000 (20:25 +0000)]
Merge "maintenance: Add 'verify' action to manageForeignResources.php"

5 years agoMerge "registration: Short-circuit if dependency constraint is '*'"
jenkins-bot [Tue, 28 Aug 2018 20:25:06 +0000 (20:25 +0000)]
Merge "registration: Short-circuit if dependency constraint is '*'"

5 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Tue, 28 Aug 2018 19:58:30 +0000 (21:58 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I03f7833c356f02d665983839012db274c4548b4a

5 years agoregistration: Short-circuit if dependency constraint is '*'
Kunal Mehta [Tue, 28 Aug 2018 19:29:04 +0000 (12:29 -0700)]
registration: Short-circuit if dependency constraint is '*'

Most extensions depend upon any version of other extensions/skins since
versioning is pretty inconsistent. Since '*' is so commonly used, explicitly
short-circuit that constraint since we only need to check whether the
dependency is loaded.

Bug: T198044
Change-Id: I5526c8068d3b9a6ee5ca71ea6bdbcd693f1ffb7a

5 years agoUpdate $wgTranscludeCacheExpiry comment
Aaron Schulz [Tue, 28 Aug 2018 17:28:45 +0000 (10:28 -0700)]
Update $wgTranscludeCacheExpiry comment

Change-Id: Ic1f20c072174732f7fd8ecab9d366125d6f0c2d2

5 years agoAdd tests for article viewing
daniel [Thu, 16 Aug 2018 15:45:10 +0000 (17:45 +0200)]
Add tests for article viewing

Bug: T174035
Change-Id: I06dc78853169812b17e0bde733d9306ccd687564

5 years agoNotifications: Note that the ID is unnecessary and deprecated
Ed Sanders [Tue, 28 Aug 2018 14:50:14 +0000 (15:50 +0100)]
Notifications: Note that the ID is unnecessary and deprecated

Change-Id: I30a3a2bd0dce6391dc075807ffbfdf6fef49d88d

5 years agoMerge "Improve logging in MediaWikiTestCase"
jenkins-bot [Tue, 28 Aug 2018 09:47:04 +0000 (09:47 +0000)]
Merge "Improve logging in MediaWikiTestCase"

5 years agoMerge "Set migration stages in RevisionStoreDbTestBase"
jenkins-bot [Tue, 28 Aug 2018 09:39:15 +0000 (09:39 +0000)]
Merge "Set migration stages in RevisionStoreDbTestBase"

5 years agoInstall giorgiosironi/eris as require-dev
Pablo Grass [Mon, 27 Aug 2018 11:24:34 +0000 (13:24 +0200)]
Install giorgiosironi/eris as require-dev

Eris is a porting of QuickCheck and property-based testing tools to
the PHP and PHPUnit ecosystem.
It is used in WikibaseLexeme to generate inputs for tests cases.
These tests are skipped if the library is not present.
T188354 / Iba3da2820262ca8a879780ee7848cfc831df28b5 removed the
extension-specific phpunit run from composer scripts.
Due to the unavailability of eris in core composer, and the fact that
the composer merge plugin does not install require-dev of extensions,
all eris-based tests have been skipped since (2018-02-17).

Change-Id: I3909fb34025d9a9e07ccd6c85b30c34144714d04

5 years agoMerge "Replace underscores with spaces in DeletedContribs form"
jenkins-bot [Tue, 28 Aug 2018 07:22:19 +0000 (07:22 +0000)]
Merge "Replace underscores with spaces in DeletedContribs form"

5 years agoMerge "Remove PhanUndeclaredStaticMethod from blacklist"
jenkins-bot [Tue, 28 Aug 2018 06:03:08 +0000 (06:03 +0000)]
Merge "Remove PhanUndeclaredStaticMethod from blacklist"

5 years agoMerge "resourceloader: Optimise several map-like objects with Object.create(null)"
jenkins-bot [Tue, 28 Aug 2018 05:47:28 +0000 (05:47 +0000)]
Merge "resourceloader: Optimise several map-like objects with Object.create(null)"

5 years agoImprove logging in MediaWikiTestCase
Tim Starling [Tue, 28 Aug 2018 02:39:33 +0000 (12:39 +1000)]
Improve logging in MediaWikiTestCase

Log test setup, start and end to the tests-phpunit log channel. This
helps when interpreting debug logs. The channel name was chosen by
analogy with the existing tests-parser log channel.

Change-Id: I2bc87564247f2f136b2244d426fa127d21663f92

5 years agoSet migration stages in RevisionStoreDbTestBase
Tim Starling [Mon, 27 Aug 2018 23:39:18 +0000 (09:39 +1000)]
Set migration stages in RevisionStoreDbTestBase

I confirmed that wgCommentTableSchemaMigrationStage needs to be set, and
getActorQueryFields() implies that the actor table migration stage needs
to be set as well.

Change-Id: I153ff985c8753b291d2201ebeed10515acb0cd36

5 years agoRemove PhanUndeclaredStaticMethod from blacklist
Erik Bernhardson [Fri, 8 Jun 2018 20:51:44 +0000 (13:51 -0700)]
Remove PhanUndeclaredStaticMethod from blacklist

There was a single instance of this issue which was reasonably simple
to solve. The code that triggered the issue was not wrong, but calling
the grandparent constructor directly is not the cleanest code so it
seems right to fix it. Switch revision initialization into an
overridable function to remove the need to even have a constructor in
the class.

Change-Id: Ic2af0d93e8d55e93061e3f4b5c7a4122509543f0

5 years agoMerge "resourceloader: Simplify addEmbeddedCSS by using object refs"
jenkins-bot [Tue, 28 Aug 2018 04:51:27 +0000 (04:51 +0000)]
Merge "resourceloader: Simplify addEmbeddedCSS by using object refs"

5 years agoresourceloader: Remove checkCssHandles for modules without styles
Timo Tijhof [Sun, 26 Aug 2018 03:44:10 +0000 (04:44 +0100)]
resourceloader: Remove checkCssHandles for modules without styles

When execute() begins, we are in a stack that is suitable for
script execution. In the case of styles needing to be inserted,
we end that stack by scheduling the styles insertion via
requestAnimationFrame. When that styles insertion is completed,
we are currently continuing the script execution in that same
stack, which is bad for performance and also creates a confusing
call stack, given that none of that code is paint or animation
related.

Before we can address that, e.g. by unwinding the stack via
requestIdleCallback, we first need to clean up the code to not
needlessly involve checkCssHandles for modules without styles.

Most modules are small and have only scripts, no styles, so this
is important to keep in a single stack and rapidly executed in
one batch - without interuption.

This commit moves the logic that was previously inside checkCssHandles
to the bottom of execute(), which is where checkCssHandles used to
be called from.

Bug: T202703
Change-Id: I13a996e01b48bab477e68ce933a5e2ef05b361aa

5 years agoresourceloader: Simplify addEmbeddedCSS by using object refs
Timo Tijhof [Sun, 26 Aug 2018 03:09:02 +0000 (04:09 +0100)]
resourceloader: Simplify addEmbeddedCSS by using object refs

* Previously, the same function was used both for adding to the buffer,
  and flushing the buffer (via self-calling alternate signatures).
  The flushing logic was split off to a flushCssBuffer function.

* Previously, when encountering an '@import' statement, it performed a
  synchronous flush, instead of the usual asynchronous ones. There was
  no reason for this, other than my laziness. I suspect because I was
  using strings, which can't be passed by reference, and I didn't
  think of another way.

  I'm now storing the string in an object, which can be passed by
  reference to the flush function. This means, as before, we can
  keep appending to its string after the flush is scheduled. But,
  unlike before, it also means we can reset our local reference and
  start a new buffer at any time and schedule that one, too.

Bug: T202703
Change-Id: Ifc6dd59e9e8885d65ba425bc579ecbfb09f2ac64

5 years agoresourceloader: Don't defer discovery of critical request via rIC()
Timo Tijhof [Tue, 28 Aug 2018 03:26:28 +0000 (04:26 +0100)]
resourceloader: Don't defer discovery of critical request via rIC()

== Overview

This reverses a small part of the big dec800968eb commit. That
commit eliminated the 2nd of 3 JS requests required on a page.

The first JS request is now modules=startup with the registry and
mw.loader. The main JS request for modules (now 2nd) is triggered
from RLQ, which fires when startup.js calls 'startUp()'.

== Regression

In commit dec800968eb, I thought I was being smart by letting the
browser "take a breath" at the end of startup.js before calling
'startUp()'. I now believe that this artifical is a mistake.

I thought it was a good idea because, before dec800968eb startup.js
made an http request (for jquery). During that network request the
main thread was free to do rendering. Then, when jquery came back,
we called startUp() to trigger our main request for modules (3rd,
now 2nd). While this request no longer exists, the idea was to keep
that thread yield at the end to startup.js.

I now think it was a mistake because requestIdleCallback is not
a "small" thread yield. Rather, I now find in production that in
the majority of cases (all mobile, and desktop first views) the
rIC is not called until *after* the page load event fires.

This means that during the entire page rendering time, the network
and javascript thread were sitting idle. Prioritising rendering and
making the page load complete 0.5s faster is great. But,
underutilising the network and delaying time to JS interation by 1-2
seconds, is bad.

== Cost

The startUp() function is quite light. All it does is a bunch of
pure JavaScript processing (no DOM), and then creates 1 script tag

On desktop (MacBook) with 6x CPU slowdown and mobile emulation
(enwiki/Obama) it clocks startUp() at 35ms.

On a real mobile device (Nexus 5, Android 4.4, the oldest currently
supported Android version/device I could find on BrowserStack) it
clocks startUp() on enwiki/Obama at 44ms.

This seems small enough to make it worth doing right away, without
artificial delay, so that it can kick off the network request in
the background while we're rendering - which is exactly how things
were before commmit dec800968eb was merged.

This means the 'load' event will once again include the main JS
request. After dec800968eb, this request unintentionally started
after the 'load' event. I'm hoping that with the eliminated
request for jquery+mediawiki.base, we'll still keep some of the
winnings we had from a much earlier 'load' event.

Bug: T192623
Change-Id: I4942bfd236c72b0cf4c23b0e2a0d5e5e069c0de0

5 years agoMerge "resourceloader: Remove redundant check in mw.loader.store for Opera 12"
jenkins-bot [Tue, 28 Aug 2018 02:11:08 +0000 (02:11 +0000)]
Merge "resourceloader: Remove redundant check in mw.loader.store for Opera 12"

5 years agoMerge "resourceloader: Remove redundant calls to getState() in mw.loader.enqueue()"
jenkins-bot [Tue, 28 Aug 2018 01:52:10 +0000 (01:52 +0000)]
Merge "resourceloader: Remove redundant calls to getState() in mw.loader.enqueue()"

5 years agoresourceloader: Optimise several map-like objects with Object.create(null)
Fomafix [Sat, 25 Aug 2018 09:57:25 +0000 (11:57 +0200)]
resourceloader: Optimise several map-like objects with Object.create(null)

Change-Id: Ia8a3159509536f58a97faadc2e72fb33f2d0e97f

5 years agoresourceloader: Move logo preload from OutputPage to SkinModule
Timo Tijhof [Mon, 20 Aug 2018 23:42:42 +0000 (00:42 +0100)]
resourceloader: Move logo preload from OutputPage to SkinModule

This was introduced in OutputPage before support for getPreloadLinks()
was added to ResourceLoader. The introduction in ResourceLoader was
actually inspired by this original implementation.

Now that we have it, we should make use of it for this module
as well. Doing so has several benefits:

* Makes the code cleaner by not requiring every skin to implement
  the extra boolean method. Instead, it naturally works. If
  the skin loads the SkinModule, it gets the preload as well.
  If not (such as Minerva, which has a different logo config),
  then it also doesn't get the preload link.
  Naturally, automatic.

* Makes code cleaner by not having static methods, and by not
  having OutputPage call into a Module class.

* Fixes the problem where, if a site's logo is changed, all cached
  HTML is preloading the old logo whilst the stylesheet fetches
  the newer one. Causing both to be downloaded.

* Still preloads the logo well before it can render.

Change-Id: I11b390f2e4f5e7db8b4506ab547839152888005c

5 years agoUse StaticArrayWriter in LCStoreStaticArray
Kunal Mehta [Sun, 19 Aug 2018 10:17:52 +0000 (03:17 -0700)]
Use StaticArrayWriter in LCStoreStaticArray

...instead of var_export(), which uses array() syntax and spaces for
indentation.

Also get rid of some unnecessary closure indirection.

Bug: T200626
Change-Id: I5db8ade50fcba5ecf394817b2d14295620314ea7

5 years agoSupport nested arrays in StaticArrayWriter
Kunal Mehta [Sun, 19 Aug 2018 10:15:31 +0000 (03:15 -0700)]
Support nested arrays in StaticArrayWriter

This is needed by LCStoreStaticArray.

Bug: T200626
Change-Id: I76abd3849381b3b98e350a4627f3515eeb00fa2d

5 years agoMerge "resourceloader: Restore mw.loader.store update postponing logic"
jenkins-bot [Mon, 27 Aug 2018 21:44:23 +0000 (21:44 +0000)]
Merge "resourceloader: Restore mw.loader.store update postponing logic"

5 years agoMerge "rdbms: make LBFactorySingle/LoadBalancerSingle set the local domain from the...
jenkins-bot [Mon, 27 Aug 2018 21:33:58 +0000 (21:33 +0000)]
Merge "rdbms: make LBFactorySingle/LoadBalancerSingle set the local domain from the connection"

5 years agoMerge "Make interwiki transclusion use the WAN cache"
jenkins-bot [Mon, 27 Aug 2018 21:17:04 +0000 (21:17 +0000)]
Merge "Make interwiki transclusion use the WAN cache"

5 years agoresourceloader: Restore mw.loader.store update postponing logic
Timo Tijhof [Thu, 23 Aug 2018 02:16:06 +0000 (03:16 +0100)]
resourceloader: Restore mw.loader.store update postponing logic

* Document the conditional that disables mw.loader.store if
  localStorage is unavailable. `raw === undefined` is correct,
  but can be confusing given it can also be null, and we
  specifically don't want to disable the store in that case.
  We only disable the store if raw is undefined.

* Remove the call to mw.loader.store.update() in init().
  If 0 modules were to load on the current page, there is little
  value in flushing an empty `items` object.
  If any modules load, they will be set() in the store and
  schedule an update() at that time, which is preferred and avoids
  unexpected overhead.

* Remove store.enabled check from prune(). It is only called
  from update(), which checks it already.
* Remove boolean return from set(). Not used.

* Remove boolean return from prune(). Not used.

* Restore the 2-second setTimeout debounce from 2013 (c719401661e),
  which got lost in the 2015 refactor (4174b662f623).
  This makes the documentation true again.

* Document the store singleton as @private. It will still be
  indexed by JSDuck and listed in the sidebar (under "private"),
  but will not be listed on the homepage, and the class' page
  will have a notice about it being a private API.

Bug: T202598
Change-Id: Ic0d4a15c241df391ab5f824ca9e754c3938ea108

5 years agoMerge "resourceloader: Remove unused code from mw.loader.register()"
jenkins-bot [Mon, 27 Aug 2018 20:55:35 +0000 (20:55 +0000)]
Merge "resourceloader: Remove unused code from mw.loader.register()"

5 years agoMerge "resourceloader: Remove unused code in private mw.loader#enqueue()"
jenkins-bot [Mon, 27 Aug 2018 20:43:43 +0000 (20:43 +0000)]
Merge "resourceloader: Remove unused code in private mw.loader#enqueue()"

5 years agoMerge "Remove semicolon after class declaration"
jenkins-bot [Mon, 27 Aug 2018 20:31:40 +0000 (20:31 +0000)]
Merge "Remove semicolon after class declaration"

5 years agoMerge "Replace "Bug37714" by "T39714""
jenkins-bot [Mon, 27 Aug 2018 20:31:34 +0000 (20:31 +0000)]
Merge "Replace "Bug37714" by "T39714""

5 years agoMerge "objectcache: Improve WANObjectCache doc for update strategies"
jenkins-bot [Mon, 27 Aug 2018 20:17:02 +0000 (20:17 +0000)]
Merge "objectcache: Improve WANObjectCache doc for update strategies"

5 years agoMerge "API: Update examples to avoid MCR deprecation"
jenkins-bot [Mon, 27 Aug 2018 20:08:52 +0000 (20:08 +0000)]
Merge "API: Update examples to avoid MCR deprecation"

5 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Mon, 27 Aug 2018 19:55:42 +0000 (21:55 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I6a4ede0f5c74135b00c63d36f1a8fb9fb5ca323a

5 years agoMake interwiki transclusion use the WAN cache
Aaron Schulz [Fri, 8 Jun 2018 20:43:03 +0000 (13:43 -0700)]
Make interwiki transclusion use the WAN cache

This means that now:
* Entries actually get deleted when expired
* The transclusion cache is shared across wikis
* Large blobs that do not fit in cache no longer cause DB errors
* DB writes are not triggered on GET requests
* Keys are hashed and no longer need to be so restrictive

Also, add a "check key" based purge system and process cache the
text/html values similar to how regular revision text is cached.

Bug: T189702
Change-Id: I8ac12b53c02bb26857175dd5a4af29d49e03dc33

5 years agoMerge "Allow admins to delete user JS/CSS pages"
jenkins-bot [Mon, 27 Aug 2018 19:32:01 +0000 (19:32 +0000)]
Merge "Allow admins to delete user JS/CSS pages"

5 years agoMerge "Paranoia, escape image alignment parameters before outputting."
jenkins-bot [Mon, 27 Aug 2018 19:10:41 +0000 (19:10 +0000)]
Merge "Paranoia, escape image alignment parameters before outputting."

5 years agoRemove semicolon after class declaration
Umherirrender [Mon, 27 Aug 2018 19:08:55 +0000 (21:08 +0200)]
Remove semicolon after class declaration

Change-Id: Iae57172138f8887e37ed401b443531259808e678

5 years agordbms: make LBFactorySingle/LoadBalancerSingle set the local domain from the connection
Aaron Schulz [Mon, 27 Aug 2018 18:50:24 +0000 (11:50 -0700)]
rdbms: make LBFactorySingle/LoadBalancerSingle set the local domain from the connection

Change-Id: I657cea85ae3838bc76e7eb50b9ca66db16746bde

5 years agoMerge "Require editsitecss/editsitejs for editing raw messages"
jenkins-bot [Mon, 27 Aug 2018 17:48:25 +0000 (17:48 +0000)]
Merge "Require editsitecss/editsitejs for editing raw messages"

5 years agoAPI: Update examples to avoid MCR deprecation
Brad Jorsch [Mon, 27 Aug 2018 17:17:55 +0000 (13:17 -0400)]
API: Update examples to avoid MCR deprecation

ApiQueryRevisions and ApiQueryDeletedRevisions each have one example
fetching the content of the revision, which needs to be updated to add
the rvslots/drvslots parameter.

Bug: T202909
Change-Id: Ibc3cbd0fbf45361da31063a3e94afb6a22e300e0

5 years agoMerge "Restore passing of triggering user in edit updates"
jenkins-bot [Mon, 27 Aug 2018 14:05:07 +0000 (14:05 +0000)]
Merge "Restore passing of triggering user in edit updates"

5 years agoReplace underscores with spaces in DeletedContribs form
Daimona Eaytoy [Tue, 8 May 2018 09:44:06 +0000 (11:44 +0200)]
Replace underscores with spaces in DeletedContribs form

If you go to Special:Contributions/User_Foo and click on the link to
Special:DeletedContributions/User_Foo, the form field for selecting the
user is populated with the value "User_Foo", which isn't pretty to see.
Instead, let's replace underscores with spaces to directly show "User
Foo".

Change-Id: I2b144c9dbe41e2dd01bbb530dc5b43547fc4230f

5 years agoMerge "Prepare DiffRenderer to changed parameters for wikidiff2 1.8.0"
WMDE-Fisch [Mon, 27 Aug 2018 08:47:59 +0000 (08:47 +0000)]
Merge "Prepare DiffRenderer to changed parameters for wikidiff2 1.8.0"

5 years agoMerge "Make warning about deprecated SlotDiffRenderer wrapper less noisy"
jenkins-bot [Mon, 27 Aug 2018 03:58:36 +0000 (03:58 +0000)]
Merge "Make warning about deprecated SlotDiffRenderer wrapper less noisy"

5 years agoobjectcache: Improve WANObjectCache doc for update strategies
Timo Tijhof [Thu, 23 Aug 2018 00:29:21 +0000 (01:29 +0100)]
objectcache: Improve WANObjectCache doc for update strategies

Also add headings to separate docs for deployment/administration,
from docs for developers using an existing instance of it.

Change-Id: Id43c7700564c2979549afa5379f644027fb6585b

5 years agoAllow admins to delete user JS/CSS pages
Gergő Tisza [Sun, 26 Aug 2018 22:51:55 +0000 (00:51 +0200)]
Allow admins to delete user JS/CSS pages

As it turns out this is super easy: we do require edit permissions
for some actions but not for delete, so it is enough to just
whitelist it.

Also fix SkinTemplate to not show the undelete action when the
user can undelete some pages but not the current one.

Bug: T200176
Change-Id: I0d326e6afde7ad2c9f7cb7f19ecc6c275c1ef65c

5 years agoRequire editsitecss/editsitejs for editing raw messages
Gergő Tisza [Tue, 31 Jul 2018 22:19:40 +0000 (00:19 +0200)]
Require editsitecss/editsitejs for editing raw messages

Bug: T45646
Change-Id: Ib16db04e499ad28216ee08b8cccccf3f141e2bad

5 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Sun, 26 Aug 2018 20:13:00 +0000 (22:13 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I8b29efe4e068289d8ce775d31aaced06c8066ef8

5 years agoMake warning about deprecated SlotDiffRenderer wrapper less noisy
Gergő Tisza [Sun, 26 Aug 2018 19:00:02 +0000 (21:00 +0200)]
Make warning about deprecated SlotDiffRenderer wrapper less noisy

Bug: T202686
Change-Id: I7623daa32e460ce131e1b27eb6e4397dc572612f

5 years agoRestore passing of triggering user in edit updates
Gergő Tisza [Fri, 24 Aug 2018 23:02:26 +0000 (01:02 +0200)]
Restore passing of triggering user in edit updates

Bug: T200119
Change-Id: I14102a15aa93d1f909c5b347f5dd589f87c2e500

5 years agoSwap arguments of Title::makeName to fix Special:Export
Umherirrender [Sun, 26 Aug 2018 17:52:17 +0000 (19:52 +0200)]
Swap arguments of Title::makeName to fix Special:Export

Follows-up 415243600b27.

Bug: T202817
Change-Id: Ica850230a5d70ae70436510811c0fed04bb995bb

5 years agoresourceloader: Remove redundant check in mw.loader.store for Opera 12
Timo Tijhof [Fri, 24 Aug 2018 03:08:06 +0000 (04:08 +0100)]
resourceloader: Remove redundant check in mw.loader.store for Opera 12

Opera 12 is no longer supported for Grade A. This regex was currently
running on every module script executed on every page in between
each module's execution.

execute() for module A -> handlePending -> mw.loader.store.set()
-> Opera 12 check -> schedule update -> yield to module B.

The serialisation logic in store.set() should probably more
generally deferred and taken out of this path, but until then,
every bit helps.

Change-Id: I8d4628b6d663fe25040c6ef0b4983a4b7eea94c6

5 years agoresourceloader: Remove redundant calls to getState() in mw.loader.enqueue()
Timo Tijhof [Fri, 24 Aug 2018 02:36:40 +0000 (03:36 +0100)]
resourceloader: Remove redundant calls to getState() in mw.loader.enqueue()

The list of module names are known to be registered there.
Thus, no need for getState() and its hasOwn.call(registry) check.

If it was possible for an unknown module name to make its way to this code,
it would break both before and after this commit due to the setting of
registry[module].state which would throw TypeError for setting on undefined.

Change-Id: Ie3cccc7e4c57648279325852f362d5eb72128306

5 years agoresourceloader: Remove unused code from mw.loader.register()
Timo Tijhof [Fri, 24 Aug 2018 02:31:48 +0000 (03:31 +0100)]
resourceloader: Remove unused code from mw.loader.register()

The optional 'dependencies' parameter is only ever used with
an array of strings, never just as a string.

Also fix the missing square-brackets around the parameter name
in the documentation that indicate the parameter as optional.
The code was already allowing it to be missing, and the server
does indeed omit it when a module has no dependencies.
(See ResourceLoaderStartupModuleTest for confirmation of that).

The server-side methods ResourceLoaderModule::getDependencies
and ResourceLoader::makeLoaderRegisterScript already don't
support string-type for this parameter.

Change-Id: I80a1e4b2eefb62e669c031e0d953bf74a9623264

5 years agoresourceloader: Remove unused code in private mw.loader#enqueue()
Timo Tijhof [Fri, 24 Aug 2018 02:26:44 +0000 (03:26 +0100)]
resourceloader: Remove unused code in private mw.loader#enqueue()

The support for 'string' type of the 'dependencies' parameter is
unused. It is a private method and only called with an array
of strings.

Change-Id: I6252ec583242df46ad4c1913519cce4ef61759d7

5 years agoRemove support for StartProfiler.php
Timo Tijhof [Sat, 18 Aug 2018 05:48:43 +0000 (06:48 +0100)]
Remove support for StartProfiler.php

Bug: T201782
Bug: T189966
Change-Id: I6ef5af969b1d74a04d5d89370e6ac800c20be1ad

5 years agoMerge "Make MysqlInstaller check if DB exists in a cleaner way"
jenkins-bot [Sat, 25 Aug 2018 22:17:26 +0000 (22:17 +0000)]
Merge "Make MysqlInstaller check if DB exists in a cleaner way"

5 years agomaintenance: Implement 'file' type and use for jquery and qunitjs
Timo Tijhof [Sat, 25 Aug 2018 04:43:43 +0000 (05:43 +0100)]
maintenance: Implement 'file' type and use for jquery and qunitjs

Change-Id: I05243e5a73664353d2b27ffca14ef0b6a3c86eaf

5 years agomaintenance: Add 'verify' action to manageForeignResources.php
Timo Tijhof [Sun, 19 Aug 2018 23:02:29 +0000 (00:02 +0100)]
maintenance: Add 'verify' action to manageForeignResources.php

* Instead of having --update and --make-sri which oddly overlap
  in less-than-intuitive ways (with dry-run in there as well),
  refactor with three simple modes:
  - make-sri: Only validates 'integrity' attribute with remote resource
              and prints it.
  - verify:   Extract files temporarily and compare with current /resources/lib/.
              Fail if diffferent.
  - update:   Extract files temporarily and move to /resources/lib/.

* Abtract code for 'tar' handling in preparation for addition of
  a 'file' and 'multi-file' type in later commits.

* Fix bug where tmp dir was not cleaned up by fatalError().

Change-Id: I5ca3749533496824d2c40ebb5ebe9e570da7ac8a

5 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Sat, 25 Aug 2018 20:15:55 +0000 (22:15 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I8e81a9820c3b8b779fa432101eb74be6831f3b48

5 years agoparser: Simplify code for {{#int:}} if the message doesn't exist
Kunal Mehta [Sat, 25 Aug 2018 08:20:43 +0000 (01:20 -0700)]
parser: Simplify code for {{#int:}} if the message doesn't exist

Ever since 184658eb32f6, the output of a non-existing message will be
HTML safe, regardless of output format, so we can treat non-existing messages
exactly the same as messages that do exist.

The pre-existing "int keyword - non-existing message" parser test verifies
that no change in output has ocurred in this patch.

Change-Id: I0e32be14f1b420d7f222ac3c76e1cc266f912b69

5 years agoMerge "Expand documentation about options in HTMLForm"
jenkins-bot [Sat, 25 Aug 2018 06:51:43 +0000 (06:51 +0000)]
Merge "Expand documentation about options in HTMLForm"

5 years agoMake MysqlInstaller check if DB exists in a cleaner way
Aaron Schulz [Sat, 25 Aug 2018 05:49:15 +0000 (22:49 -0700)]
Make MysqlInstaller check if DB exists in a cleaner way

Query the information schema rather than seeing if selectDB() returns false.
This makes the installer able to handle an exception based failure mode.

Change-Id: I7912b9d3b8501fbc92cb731547ae10fa2b0176db

5 years agoMerge "mediawiki.user: Small perf tweak for generateRandomSessionId"
jenkins-bot [Sat, 25 Aug 2018 05:17:58 +0000 (05:17 +0000)]
Merge "mediawiki.user: Small perf tweak for generateRandomSessionId"

5 years agomediawiki.user: Small perf tweak for generateRandomSessionId
Nuria Ruiz [Thu, 23 Aug 2018 23:07:33 +0000 (16:07 -0700)]
mediawiki.user: Small perf tweak for generateRandomSessionId

Consolidate loop + join into explicit string concatenation

Bug: T201124
Change-Id: Ie7c7ddd29783ada142fbb7b726caa697048802f3

5 years agoMerge "resourceloader: Micro-optimise mw.loader.register version string setting"
jenkins-bot [Fri, 24 Aug 2018 22:33:36 +0000 (22:33 +0000)]
Merge "resourceloader: Micro-optimise mw.loader.register version string setting"