Commit graph

85013 commits

Author SHA1 Message Date
Erik Bernhardson
c94dea7029 Only strip newline in OrderedStreamingForkController
The controller should pass through lines of input exactly as
they were provided, only stripping the trailing newline that
delimits items. The trim was making `door` and `door ` equivilant
but for the use case in search the distinction is important.

Additionally check that the line is actually empty, don't throw
away inputs like '0' which are falsy.

Change-Id: Ifac910543fdb46a27da021e831e3e18befefcfc5
2018-09-28 12:00:32 -07:00
jenkins-bot
e2e9117a51 Merge "Handle empty revision table in populateArchiveRevId.php" 2018-09-28 15:58:05 +00:00
jenkins-bot
92a0de2761 Merge "Suggest "apcu" not "apc" in composer.json" 2018-09-28 06:12:50 +00:00
Kunal Mehta
ba701be532 Suggest "apcu" not "apc" in composer.json
apc is the pre-PHP 5.5 extension that was partly merged into PHP itself
(the opcode caching), and partly split into a separate apcu extension for
the userland caching. We want people to install apcu for better performance.

Note that we still need to support apc because of HHVM.

Change-Id: I5830a66bc86ff321bf9141d2b65eedb4802e404f
2018-09-27 22:26:16 -07:00
Kunal Mehta
68015d3b91 BitmapMetadataHandlerTest: Don't reinvent $this->checkPHPExtension()
Change-Id: I4957ca1be698844bafbf8de64af450cb884ec71a
2018-09-27 22:01:28 -07:00
Timo Tijhof
c8ca57f903 exception: Report uncaught "Catchable" fatal to "fatal" channel
Things like "Catchable fatal error: Must be X, null given" stop
execution immediately after the error handler callback, and produce
an HTTP 500 Internal Server Error page. They are very fatal.

Per <https://secure.php.net/manual/en/language.errors.php7.php>,
on PHP 7 this results in a TypeError throwable which will
eventually fatal the request and be reported through
set_exception_handler, or be caught by our top-level 'catch'
and artificially forwarded to our set_exception_handler callback.

On HHVM, these fatal error types are PHP5-like in that they
don't have a throwable object to throw yet, instead the error
meta-data is sent directly as parameeters to set_error_handler,
the same as for warnings. We need to intercept them there so
that they are reported correctly.

Sample from PHP 7:

> MediaWiki\Storage\MutableRevisionRecord::newFromParentRevision( null );
> [no req]   TypeError from line 50 of .../MutableRevisionRecord.php:
> Argument 1 passed to ...\MutableRevisionRecord::newFromParentRevision()
> must be an instance of MediaWiki\Storage\RevisionRecord, null given,
> called in /var/www/mediawiki/maintenance/eval.php(78) ...

[exit status: error(255)]

Sample from HHVM:

> MediaWiki\Storage\MutableRevisionRecord::newFromParentRevision( null );
> [hphp] set_error_handler called with:
> ...  $type = 4096 // E_RECOVERABLE_ERROR
>
> [hphp] [...] Catchable fatal error:
> Argument 1 passed to ...\MutableRevisionRecord::newFromParentRevision()
> must be an instance of MediaWiki\Storage\RevisionRecord, null given
> ...

[exit status: error(255)]

Interestingly, if you forget to return false from set_error_handler
for fatal errors on HHVM, it can actually continue execution.

Bug: T205677
Change-Id: I18dd2ff37fa2c2679d0c598cbeff0c61c2fe0253
2018-09-28 00:43:22 +00:00
James Montalvo
e49ea91fad Handle empty revision table in populateArchiveRevId.php
Running update.php for new wikis without any revisions yet fails when
update.php attempts to run populateArchiveRevId.php. This problem
does not exist if using the web installer or running
maintenance/install.php, since both of these generate a Main Page
revision. Manually generating a MediaWiki database by sourcing
maintenance/tables.sql does not generate any revisions, and thus is
susceptible to this problem.

Bug: T203982

Change-Id: Ifd78c50fb1e11f82340cd83a10fa903b7c5fc1e7
2018-09-27 17:18:14 -07:00
jenkins-bot
d150ebc3aa Merge "exception: Avoid preg_replace for literal swap" 2018-09-27 19:45:41 +00:00
C. Scott Ananian
f6081797f3 Add basic test cases for OutputPage::addWikiMsg / wrapWikiMsg
Change-Id: I621c22f2819b426ce6088ff3bdf1dadca274d1f9
2018-09-27 13:41:55 -04:00
jenkins-bot
bb1d8568d7 Merge "Special:NewFiles - ensure top text is entirely wrapped" 2018-09-27 17:11:12 +00:00
Timo Tijhof
8476ec3cb8 exception: Avoid preg_replace for literal swap
Follows-up bbcbcaba3d.

Change-Id: Ie7b76c28ba53668d73a8435c4d2ec91757bd2372
2018-09-27 17:39:42 +01:00
C. Scott Ananian
b993218939 Special:Import - wrap error messages with <div> not <p>
Localized messages are wikitext and can contain `<div>` or `\n\n` which
would break `<p>` wrappers.  Be consistent with the rest of the codebase
and use `<div>` wrappers here.

Bug: T205624
Change-Id: I1e8ff5985f3a7780ad9ba063827c515e997cb508
2018-09-27 14:24:06 +00:00
C. Scott Ananian
df944a1879 Special:NewFiles - ensure top text is entirely wrapped
The template on commons for newimagestext has a <div> wrapper,
and trying to wrap a <p> around a <div> doesn't work: the <p> is
implicitly closed by the start of the <div>.  Use a <div> wrapper
to set the content language and directionality instead, which ensures
that it is valid HTML and will be tidied correctly.

In the process, fix an extra argument (and unnecessary optional argument)
passed to OutputPage::addWikiTextTidy in
Ife33ceed39ed01d4e9af18e9108026f341e9b343.

Bug: T205624
Change-Id: I42d198e6d03afd5b976da741f235c175bfe9f767
2018-09-27 14:23:25 +00:00
jenkins-bot
809d9b6845 Merge "copyedit patch-parsercache.sql comment" 2018-09-27 00:29:09 +00:00
Reedy
6ee0b58499 copyedit patch-parsercache.sql comment
Change-Id: Ie0a9d9dc11bd6944cabd30952fa836745e3f22b9
2018-09-26 22:36:24 +01:00
jenkins-bot
50f6b24ee6 Merge "Parser: Refactor parsing of [[File:...|link=...]] syntax for reusability" 2018-09-26 19:18:34 +00:00
jenkins-bot
f77b1ed3c4 Merge "Rephrase 'imagemaxsize' message (used on preferences)" 2018-09-26 16:04:45 +00:00
Bartosz Dziewoński
d7e3f05e67 Rephrase 'imagemaxsize' message (used on preferences)
* Remove the forced line break, which is not necessary for old
  preferences page and which makes it worse for the new OOUI
  preferences page
* Remove the italic styling, which is not used by any other
  preferences

Change-Id: Ie80583c82d8e748e063f7d831ebb3bb20dc2b64a
2018-09-26 17:34:52 +02:00
jenkins-bot
9cd8d3e2d7 Merge "wdio-mediawiki: relative internal lookups" 2018-09-26 15:16:02 +00:00
Bartosz Dziewoński
3f8d6fa8f5 Fix double-wrapped HtmlArmor causing fatals
Follow-up to a89ef9b3b9. I'm guessing
this is supposed to be htmlspecialchars() based on the changes to
other files in that patch (e.g. SpecialAncientpages.php).

Bug: T205469
Change-Id: I52e38a5754b339e1516498e6f0eb73fc8d8df59c
2018-09-26 14:03:38 +00:00
jenkins-bot
1dee28cb5f Merge "Simplify HTMLTitleTextField::validate" 2018-09-26 13:19:49 +00:00
jenkins-bot
2d75c56c17 Merge "Add constant for the name of the 'main' slot for MCR" 2018-09-26 11:55:10 +00:00
Bartosz Dziewoński
1c9664d18a Parser: Refactor parsing of [[File:...|link=...]] syntax for reusability
Change-Id: I91467297de4b7c532448a4c20b9a0dc8216c7200
2018-09-26 13:36:32 +02:00
Translation updater bot
a6a37af868 Localisation updates from https://translatewiki.net.
Change-Id: I07d0eeb9c99e1551899d05453abc0398444210aa
2018-09-26 12:56:01 +02:00
jenkins-bot
e5fcac607b Merge "Use OutputPage::addWikiTextTidy() when text is in content language" 2018-09-26 10:50:36 +00:00
jenkins-bot
361f73a912 Merge "Don't wrap output added by OutputPage::addWikiText*()" 2018-09-26 10:50:27 +00:00
Pablo Grass
382582f7b9 wdio-mediawiki: relative internal lookups
"Internal lookups need to be internal, using ./.
This currently works because it executes as part of mediawiki-core, but
may fail when used from the published package, because there will not
be another "wdio-mediawiki" inside this directory." krinkle
Follow-up to a fixme in Ifc49bc5c06eef71da8aff1b1837c32debc2c45dd

Change-Id: I86f321a42eaf4cf706b4e899e4cd460654840284
2018-09-26 12:36:45 +02:00
jenkins-bot
c0fa6997ae Merge "Logging related to WikiExport cleanup and changes in T203424" 2018-09-26 03:29:49 +00:00
jenkins-bot
e2e484e703 Merge "ImageHistoryPseudoPager: Protect against TimestampException from bad user input" 2018-09-26 00:48:42 +00:00
James D. Forrester
485547cd80 ImageHistoryPseudoPager: Protect against TimestampException from bad user input
Bug: T204796
Change-Id: I17455fef0d899c56ce10f0df0db3457d944e353d
2018-09-26 00:32:07 +00:00
jenkins-bot
c5d44cc0cf Merge "Forward X-Search-ID header to search suggest tracking" 2018-09-25 20:24:41 +00:00
jenkins-bot
bf2da61424 Merge "Tidy and rename WebInstallerOutput::addWikiText() to addWikiTextInterface()" 2018-09-25 19:42:28 +00:00
Erik Bernhardson
a7bf9ac2c5 Forward X-Search-ID header to search suggest tracking
This header can be injected into api responses that include
search results to provide a link between the backend logs
and any frontend logging. Associating autocomplete tracking
with backend logs will allow us to determine autocomplete
examination probabilities, and more generally be able to
evaluate autocomplete effectiveness.

Bug: T205348
Change-Id: I1663906e2fd71f7df215e563b09a0b4fb8948ab8
2018-09-25 12:36:58 -07:00
jenkins-bot
0cc987680f Merge "OutputPageTest should be independent of $wgResourceLoaderDebug setting" 2018-09-25 19:36:07 +00:00
C. Scott Ananian
1c10bfb034 Tidy and rename WebInstallerOutput::addWikiText() to addWikiTextInterface()
This change parallels the new method added to OutputPage in
Ia58910164baaca608cea3b24333b7d13ed773339 and ensures that the
content added is always tidied.  We leave the old alias in
place for now in accordance with our deprecation policy.

Change-Id: I89f3398cffa771afcd5a33cfd11eb8510af3e7f7
2018-09-25 14:47:33 -04:00
C. Scott Ananian
23edf377dc Use OutputPage::addWikiTextTidy() when text is in content language
The default for OutputPage::addWikiText is $interface=true, which
suppresses language conversion and treats the output as being in
the user interface language.

Change-Id: Ife33ceed39ed01d4e9af18e9108026f341e9b343
2018-09-25 14:43:20 -04:00
C. Scott Ananian
300b91a1ec Don't wrap output added by OutputPage::addWikiText*()
There are three methods affected: `OutputPage::addWikiTextTidy()`,
`OutputPage::addWikiTextTitleTidy()`, and
`OutputPage::addWikiTextWithTitle()`.

There's a special case in Parser.php which adds the wrapper class from
ParserOptions to the ParserOutput only if "interface mode" is off; the
affected methods default to adding output in "content language" mode
(not "interface language" mode), but they seem to be used for
"interface messages in the content language" (rare) and so should also
be unwrapped.  This would make all the `OutputPage::addWikiText*()`
methods consistent.

The `OutputPage::addWikiTextTidy()` method is only used once in the WMF
repositories, where it is used to insert an interface message in the
content language:

91cd2a928f/SpecialProofreadPages.php (40)

The `OutputPage::addWikiTextWithTitle()` method is used by no one:

https://codesearch.wmflabs.org/search/?q=addWikiTextWithTitle%5C(

The `OutputPage::addWikiTextTitleTidy()` method is used only in core:

3888c001a1/includes/EditPage.php (2669)

It seems clear that the output in this case is intended to be
unwrapped as well (the codepath adds its own explicit wrapper).

Ia58910164baaca608cea3b24333b7d13ed773339 will add additional
documentation to clarify the distinction between the different
OutputPage::addWikiText*() methods, but I felt it safer to make
this particular change first as a standalone patch, just in case
it had unexpected side effects or merited further discussion.

Change-Id: I3e5b598d358819191562b56d40ebf1cb6f3cda41
2018-09-25 14:43:20 -04:00
C. Scott Ananian
787a647026 Make maintenance/parse.php default to tidy output
We are deprecating the non-tidy modes of the parser.

While we're at it, remove the output wrapper by default (in
both tidy and no-tidy modes).

Bug: T198214
Change-Id: Ieb51cb0f3a8a62e272d76c368f29fb63c030c522
2018-09-25 13:31:36 -04:00
jenkins-bot
3aad4bcdab Merge "Ensure disabled deprecation warnings are re-enabled before next test" 2018-09-25 17:13:14 +00:00
C. Scott Ananian
36f14abd26 OutputPageTest should be independent of $wgResourceLoaderDebug setting
`OutputPageTest::testMakeResourceLoaderLink()` and
`OutputPageTest::testBuildExemptModules()` tried to force
`$wgResourceLoaderDebug=false` before running the test, but they
neglected to clear the resource loader debug cache
(`ResourceLoader::clearCache()`) so the user's local setting of
`$wgResourceLoaderDebug` would be used despite it all.

Change-Id: I3e7dec762c8a02683fc66a630c950b72a4840a9b
2018-09-25 12:56:40 -04:00
jenkins-bot
9b1d351323 Merge "Deprecate the 'disabletidy' parameter for ApiParse" 2018-09-25 16:50:36 +00:00
jenkins-bot
c4a923d134 Merge "OutputPageTest: Don't rely on side effects of previous tests" 2018-09-25 16:41:07 +00:00
jenkins-bot
5d16ee80e2 Merge "Suppress deprecation warnings for b/c use of UsageException::getMessageArray()" 2018-09-25 16:41:02 +00:00
C. Scott Ananian
8025629395 Ensure disabled deprecation warnings are re-enabled before next test
Tests should not interfere with each other; disabled deprecation
warnings should be disabled for a single test case only.

Bug: T191960
Change-Id: Ic9b892bc83ba6d71c1077df0d93c95dde36988bb
2018-09-25 16:30:38 +00:00
C. Scott Ananian
775bcac172 OutputPageTest: Don't rely on side effects of previous tests
Use the proper `MediaWikiTextCase::hideDeprecated()` method.

Bug: T191960
Change-Id: I974618a0bd1e11434d167820d119dcfd6e47b092
2018-09-25 10:22:52 -04:00
Reedy
ed6d53fd38 Add a maintenance script to remove all users from a User Group
Bug: T185989
Change-Id: Ie5cc95b350230bc730c1f1d9f06fc3e95c5f6bd0
2018-09-25 00:57:16 +00:00
Gergő Tisza
6e8d39c6e7
Add constant for the name of the 'main' slot for MCR
Bug: T202142
Change-Id: I97a74e5a029b014f3c2195188936d5c8233c1b7f
2018-09-24 16:52:12 -07:00
Kunal Mehta
3888c001a1 Hard deprecate EventRelayerGroup::singleton()
No uses spotted by codesearch.

Change-Id: If2bffc7a216cf7b437ff112794742d5af0dd30fd
2018-09-24 16:09:28 -07:00
jenkins-bot
de158f8195 Merge "Remove repeated line in RELEASE-NOTES-1.32" 2018-09-24 22:27:57 +00:00
jenkins-bot
6d4f11c2e3 Merge "Use binary charset in default table options" 2018-09-24 22:12:55 +00:00