Commit graph

6519 commits

Author SHA1 Message Date
daniel
b8e58c039a Reuse DerivedPageDataUpdater during null-edits.
Checking the acting user against the revision's author in
DerivedPageDataUpdater::isReusableFor would lead to false
negatives.

Also removes a check of the current acting user against the
cached revision's author, for the same reason: for null edits,
the acting user and the revision author are unrelated.

Bug: T205369
Change-Id: I48f59dce6c25062b3d6ff4248e1171269766c507
2018-11-16 18:58:54 +01:00
Agabi10
4985ce5134 Add a way to exclude categories from Special:UnusedCategories
Added __EXPECT_UNUSED_CATEGORY__ as a behavioral switch. Adding
this switch to category pages prevents them from appearing in
Special:UnusedCategories.

Bug: T96041
Change-Id: I055e59f5311347155e0f801dd5ec9a6d4a68c9cc
2018-11-16 13:32:27 +00:00
Dayllan Maza
d361d8cbec Fix partial block translation for non-editing msg
The current phrasing for non-editing partial blocks was not clear.
Adding 'specified' as part of the message to avoid confusion.

Bug: T208806
Change-Id: If6fe6397060a38dd5036d2c0c1d58aa9e798ecc1
2018-11-15 23:11:11 -05:00
C. Scott Ananian
6db35b3c98 Remove most support for configuring Tidy, including Raggett
Remex is pure PHP so there is no reason to use an external tidy any
more. Configuration variables and implementation classes were
deprecated in 1.32 or earlier.  We've kept only $wgTidyConfig
which can be used for experimental features or debugging Remex.

Bug: T198214
Change-Id: I99d48f858d97b6e1d1e6cd76a42c960cc2c61f9f
2018-11-15 12:22:06 -05:00
Brad Jorsch
d099bb6f95 Drop the image_comment_temp table
It is no longer used.

Bug: T188132
Change-Id: Ic8efeddc030f48e82ba861926121b64eca37d169
2018-11-14 15:04:31 -05:00
David Barratt
f205e6e9f0
Action::checkCanExecute should only block an Action if the user is sitewide blocked
The method over-enforces partial blocks by preventing users from performing
the action on unrelated pages.

Bug: T209284
Change-Id: I4ee0e7c0188d491cf8fc0bbbbf7e492cdf309f45
2018-11-14 14:45:30 -05:00
David Barratt
b1e4ca70b8
Title::checkUserBlock should call User::isBlockedFrom for every action
Currently, not all actions are processed by User::isBlockedFrom(). This results
in users who are partially blocked from specific pages to be blocked from
moving and deleting all pages.

Bug: T208862
Change-Id: I6312a36911e5b73d773452fefef7ff25b9af08a4
2018-11-14 14:19:29 -05:00
jenkins-bot
65f12f7190 Merge "Set migration stage for change tag to read new" 2018-11-14 16:28:34 +00:00
jenkins-bot
7a3eb1f3a6 Merge "Hard deprecate codepaths where tidy is disabled" 2018-11-13 23:54:24 +00:00
jenkins-bot
5466734477 Merge "doc: Modernise parameter names and documentation for 'replica' DBs" 2018-11-13 21:39:14 +00:00
Daimona Eaytoy
495331ff07 Add a Status and a $reason parameter to TitleMove hook
So that using this hook it's possible to prevent the move, also
providing some more context.
Also, clean error message: instead of going with "you do not have
permission blah blah" for *every* kind of error, use it only when the
error is actually about permissions, and use a generic message
otherwise.

Bug: T208907
Change-Id: I4733724075b7514e9db59e7be772d9409aa9da87
2018-11-13 08:51:02 +00:00
jenkins-bot
d7fba6c62d Merge "Comments, tests, and tweaks for JSON decoding quirks" 2018-11-13 02:44:02 +00:00
Brad Jorsch
d65e96b763 Use new externallinks.el_index_60 field
This adds a method to LinkFilter to build the query conditions necessary
to properly use it, and adjusts code to use it.

This also takes the opportunity to clean up the calculation of el_index:
IPs are handled more sensibly and IDNs are canonicalized.

Also weird edge cases for invalid hosts like "http://.example.com" and
corresponding searches like "http://*..example.com" are now handled more
regularly instead of being treated as if the extra dot were omitted,
while explicit specification of the DNS root like "http://example.com./"
is canonicalized to the usual implicit specification.

Note that this patch will break link searches for links where the host
is an IP or IDN until refreshExternallinksIndex.php is run.

Bug: T59176
Bug: T130482
Change-Id: I84d224ef23de22dfe179009ec3a11fd0e4b5f56d
2018-11-12 22:33:18 +00:00
jenkins-bot
d4780d84c0 Merge "Add test for completionSearch with wgCapitalLinkOverrides" 2018-11-08 16:01:20 +00:00
Bill Pirkle
5a166f00d8 Comments, tests, and tweaks for JSON decoding quirks
PHP JSON decoding has surprising behavior on some edge cases.
Documented this via comments, added related tests, and tweaked
related CommentStore code.

Bug: T206411
Change-Id: I6927fdaf616b37a04d81a638a0ed257afac9b844
2018-11-07 13:04:21 -06:00
jenkins-bot
ee00b6853b Merge "Remove excessive indenting of parameters on newlines" 2018-11-07 15:31:30 +00:00
jenkins-bot
d4cc4f2b4f Merge "Render namespace lists in the user's language" 2018-11-07 15:14:20 +00:00
Aaron Schulz
51945dbca3 Use DB domain in JobQueueGroup and make WikiMap domain ID methods stricter
Using domains means thats JobQueueDB has the right value to use for calls
like LoadBalancer::getConnection(). The full domain includes the schema in
the case of Postgres. This makes calls to getConnection() less awkward by
not relying on the fallback logic in reallyOpenConnection() for null schemas.

Make getWikiIdFromDomain/isCurrentWikiDomain account for the schema if it
is both defined and is not simply the generic "mediawiki" schema MediaWiki
uses by default. If all wikis use the default schema, the wiki IDs can get
by with DB/prefix alone, which various config and methods may be built around.
Otherwise, the config callbacks must account for schema and the config must
include it in various wiki domain ID lists to properly disambiguate wikis.

Also, clean up SiteConfiguration::siteFromDB() since it is not meant
to handle schemas unless the callback method was taylored to do so.

Finally, add more comments to DefaultSettings.php about already existing
limitations of wiki domain IDs and their components.

Change-Id: I8d94a650e5c99a19ee50551c5be9544318eb05b1
2018-11-07 04:46:56 +00:00
David Causse
c9d3eb8e6d Add test for completionSearch with wgCapitalLinkOverrides
Bug: T208255
Change-Id: Id2299a013b2dc9b5391d400d7c7c4dc37185f714
2018-11-06 15:03:16 +01:00
Reedy
633b6532fa Remove excessive indenting of parameters on newlines
Change-Id: I4e214b55b9936be2336a97192f9716b3ea7d6d61
2018-11-06 10:57:17 +00:00
Max Semenik
d7e520fbbb Preferences class deprecation, step 2
Remove all functions that have been hard (or superhard, with exceptions)
deprecated previously. They all had no callers with one exception:
* getTimezoneOptions() is called from 3rd party extention, already broken
  anyway.

Mark the remaining functions for removal in 1.34, where whole class
will become {{db-empty}}. They in principle have no callers already, but
let's follow the proper process and give extension developers a bit more
time.

Change-Id: I0e3e98ed1e6242b6ab7c5f21d71478c392fe89a9
2018-11-05 10:53:43 -08:00
C. Scott Ananian
54ac31f94d Hard deprecate codepaths where tidy is disabled
Future parsers will not support the output generated with tidy disabled.

Parser tests using untidied output will also be deprecated (and
rewritten) in a follow-up patch.

No new release notes necessary since user-visible tidy configuration
was deprecated previously (in 1.32), and individual methods which had
disabled tidy during execution were individually release-noted as they
were updated.

Bug: T198214
Depends-On: I0f417f75a49dfea873e9a2f44d81796a48b9f428
Depends-On: If5c619cdd3e7f786687cfc2ca166074d9197ca11
Change-Id: I592e0e0dfef7d929f05c60ffe4d60e09725b39cc
2018-11-05 18:49:16 +00:00
jenkins-bot
0098688a00 Merge "Hard deprecate OutputPage::parse() and OutputPage::parseInline()" 2018-11-05 18:07:29 +00:00
Brad Jorsch
74ff87d291 Block: Clean up handling of non-User targets
The fix applied in d67121f6d took care of the immediate issue in
T208398, but after further analysis it was not a correct fix.

* Near line 770, the method shouldn't even be called unless the target
  is TYPE_USER.
* Near line 1598, it isn't dealing with a target at all.
* Near line 1813, you're not going to get a sensible result trying to
  call `$user->getTalkPage()` for a range or auto-block ID. What you
  would really need there to handle range and auto-blocks correctly is
  to pass in the User actually making the edit.

But after some pushback in code review about passing the User into
Block::preventsEdit() to make line 1813 work, we'll instead replace the
method with Block::appliesToTitle() and put the check for user talk
pages back into User::isBlockedFrom().

Bug: T208398
Bug: T208472
Change-Id: I23d3a3a1925e97f0cabe328c1cc74e978cb4d24a
2018-11-02 12:33:57 -04:00
Alangi Derick
cbdff71add Fix typo in tests/includes/SampleTest.php in core
Minor typo fix in comments for setUp() and provideTitles()
methods in SampleTests.php file.

Change-Id: I09e0fb041d6809509e780d22bf8419497cd50ee7
2018-11-02 12:55:09 +00:00
Amir Sarabadani
bb07b4a368 Set migration stage for change tag to read new
Plus removing not needed config

Bug: T185355
Change-Id: Iaa8bfbbbf4fa939bbc7a1a0ec0b00c8af97abfaa
2018-11-02 13:52:55 +01:00
C. Scott Ananian
4d596861e5 Hard deprecate OutputPage::parse() and OutputPage::parseInline()
Depends-On: I2cc3a4631bcb45b7f8cd913e9b6dba14349e5e9e
Depends-On: Ieaac7a198cacec406a8240ed07b2d9f32ef9e56a
Depends-On: Ia4b63715380d97ccb3133bf39a260834c20b4f5a
Depends-On: I88fb74c3007360e2301c8bca7db6a940e966a735
Change-Id: If5c619cdd3e7f786687cfc2ca166074d9197ca11
2018-11-01 21:32:56 +00:00
Alangi Derick
b86593a2da Fix undefined NS with @covers tags in /includes/auth/
Should MW Codesniffer also handle these as well?

Change-Id: Ieb493bddd5f3674fb889b4a780d51b50d89c4f65
2018-11-01 12:48:52 +01:00
Kunal Mehta
674e486cb5 Recognize CSS/JS redirects with non-ASCII targets
The regex in JavaScriptContent and CssContent was trying to pass
urlencoded stuff to Title::newFromText(), which would fail. Make sure we
urldecode it first.

Bug: T208264
Change-Id: I189c4c308da2875839ad8c1061332500f0e6d244
2018-10-31 23:09:50 -07:00
jenkins-bot
07850059ee Merge "Fix IP handling in DerivativeRequest" 2018-11-01 04:00:29 +00:00
Gergő Tisza
3331e9d26c Fix IP handling in DerivativeRequest
$r->getIP() should return what was set by $r->setIP(); currently
that breaks for DerivativeRequest as get reads from the base but
set writes on the derivative.

Change-Id: If30c233931ceb1ca05da8866da3c3ab78de1a339
2018-10-31 20:34:58 -07:00
James D. Forrester
903e8b63de doc: Modernise parameter names and documentation for 'replica' DBs
Non-breaking change. Remaining uses are public interfaces (a constant, two
globals, a config sub-parameter, SQL queries, storage function names), one i18n
message key, and a whole lot of maintenance scripts with calls to the deprecated
function wfWaitForSlaves().

Change-Id: I6ee5ca92ccf6a80c08f53d9efe38ebb4b05064d7
2018-10-31 10:36:48 -07:00
Marius Hoch
13f1ce8244 DatabaseSqlite::insert: Fix affected row count
Follow up to 633eb437a3

Bug: T208331
Change-Id: I142bb8c8abd43242d098932da212aa58323a0863
2018-10-31 17:13:45 +01:00
Max Semenik
c16704c33a Display SVGs in target language
Previously, they were always displayed in defult language unless
forced explicitly in wikitext, e.g. [[File:Foo.svg|lang=ru]].
This change adds a feature flag that would enable always trying to
display in page language.

* If enabled, Parser will pass a new parameter - 'pagelang' - to
  the media handler.
* SvgHandler uses page language when determining what language to
  render the image in.
* 'pagelang' can always be overridden by 'lang'.
* If no translation in page language is available, the default
  language (English) will be used for thumbnail URLs, to prevent
  cluttering media storage and HTTP caches with useless copies.

Performance: this requires accessing image's metadata during parsing.
My testing indicates there were no code path where this wasn't the
case already, so no performance hit is expected, however we should
still keep an eye on page save performance.

Bug: T205040
Change-Id: I348840ef405e1370cc0c17d69051bce30153c9c0
2018-10-30 16:12:11 -07:00
Aaron Schulz
633eb437a3 rdbms: clean up return values of IDatabase write methods
Also improved the atomicity and affected row count logic for
insert/replace with sqlite.

Also remove unused "fileHandle" code from insert().

Change-Id: If7b9148fd44f3a958899885753c7c86ba66bf193
2018-10-30 03:34:52 +00:00
jenkins-bot
c6ad2554f4 Merge "Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap" 2018-10-29 22:27:15 +00:00
Aaron Schulz
dcd0a3d534 Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
Use these in place of various wfWikiID() calls.

Also cleanup UserRightsProxy wiki ID variable names and removed unused
and poorly named getDBname() method.

Change-Id: Ib28889663989382d845511f8d34712b08317f60e
2018-10-29 14:53:37 -07:00
C. Scott Ananian
a3f63785ee Deprecate OutputPage::parse() and OutputPage::parseInline()
The OutputPage::parse() and OutputPage::parseInline() methods behave
misleadingly different from the OutputPage::addWikitext*() methods:
they don't tidy their output, they have different defaults for
interface/content language selection, and they (sometimes) add
wrapper divs.  Deprecate these and add new methods with tidy output,
clear language selection, and consistent defaults:
OutputPage::parseAsContent(), OutputPage::parseAsInterface(),
and OutputPage::parseInlineAsInterface().

Unify the implementation of the parse* methods with the addWikiText*
methods, to reduce the likelihood that the behavior will diverge again
in the future.

Bug: T198214
Change-Id: Ica79c2acbc542ef37f971c0be2582ae771a23bd0
2018-10-29 15:34:40 -04:00
jenkins-bot
dc92754891 Merge "Fix OutputPage::parseInternal() by stripping <div> wrapper" 2018-10-29 18:55:22 +00:00
jenkins-bot
cb4d4c4d8f Merge "Move user_editcount updates to a mergeable deferred update" 2018-10-26 20:32:24 +00:00
C. Scott Ananian
db4fa6fb9f Fix OutputPage::parseInternal() by stripping <div> wrapper
We should probably strip the <div> wrapper in OutputPage::parse() as
well: this behavior was added in 1.30, but it only applies when
$interface is false.  However, that requires a more careful audit
(a lot more places call parse() than parseInline()) and so I'll defer
that for now.

Change-Id: Iad5412f03af29c04deb653969dd71f6c86f0ae50
2018-10-26 11:20:26 -04:00
Tim Starling
a6a017cea4 Fix use of non-existent variable Parser::$config
Fix bug from Ib4394f370cb561ccf195338a1c2e9e465dcb3dc3

Add test.

Bug: T208000
Change-Id: Ia81cca1b64afef2af3cb8dff19719a7f0de9d306
2018-10-25 16:27:55 -07:00
Aaron Schulz
390fce6db1 Move user_editcount updates to a mergeable deferred update
This should reduce excess contention and lock timeouts.
Previously, it used a pre-commit hook which ran just before the
end of the DB transaction round.

Also removed unused User::incEditCountImmediate() method.

Bug: T202715
Depends-on: I6d239a5ea286afb10d9e317b2ee1436de60f7e4f
Depends-on: I0ad3d17107efc7b0e59f1dd54d5733cd1572a2b7
Change-Id: I0d6d7ddd91bbb21995142808248d162e05696d47
2018-10-25 15:32:18 -07:00
Aaron Schulz
c4d9d51506 Clear the title cache in MutableRevisionRecordTest
Also do so in various other test classes.

Follows-up 170c49d61c. Fixes Travis CI regression:

> 1) MediaWiki\Tests\Revision\MutableRevisionRecordTest::testSetGetPageId
> Failed asserting that 2 is identical to 0.
> tests/phpunit/includes/Revision/MutableRevisionRecordTest.php:129

Change-Id: I41c8bda8e620ebe7608a393d81f3b0f13af68ba7
2018-10-25 21:16:27 +00:00
Aaron Schulz
4108381175 Make testFormatValueRestrictions() account for $wgArticlePath to avoid failures
Follows-up 170c49d61c.

Change-Id: I37a57b5ece939c5743b7d08d02ce41c71daee5eb
2018-10-25 21:14:34 +00:00
Roan Kattouw
13a1d8957b WikiPage: Truncate redirect fragments before inserting them into the DB
The rd_fragment field is 255 bytes wide, but there is no limit on how
long title fragments can be. We don't want to let the database silently
truncate the fragment for us, because that can result in invalid UTF-8.
Instead, truncate it before insertion in a UTF-8-aware way.

Bug: T207876
Change-Id: I12745f3f4c174eaced56d80f3661a71d0e5637e6
2018-10-24 17:33:56 -07:00
jenkins-bot
0d2dd9cf37 Merge "Hard deprecate functionality replaced with random_bytes()" 2018-10-24 22:13:06 +00:00
jenkins-bot
23b8bd2ad0 Merge "Hard deprecate non-tidy OutputPage::addWikiText() method" 2018-10-24 22:13:00 +00:00
jenkins-bot
f57c8f9da0 Merge "Tidy Message::parseAsBlock() by enabling tidy in MessageCache" 2018-10-24 20:35:06 +00:00
C. Scott Ananian
45305de579 Hard deprecate non-tidy OutputPage::addWikiText() method
Tidy will always be enabled with our future parsers.  Hard-deprecate
this method which doesn't tidy the output.

Users of `OutputPage::addWikiText()` will be converted one-by-one to
`OutputPage::addWikiTextAsInterface()` so that any unexpected issues
(deliberately untidy wikitext added, which should be rare) can be
addressed.

Bug: T198214
Depends-On: I778ba9e6efed576605f492c9a073c7203b6c0477
Depends-On: I16529879a3b3aed960c5dc006e2af513d7e91fcd
Change-Id: If8353c37245d9d233d589f82c198668ccb3fce05
2018-10-24 20:05:58 +00:00
David Barratt
b3014df3b6 List Partial Block details in ApiQueryBlocks and ApiQueryUserinfo.
The ApiQueryBlocks and ApiQueryUserinfo endpoints will now return whether or not the block is
sitewide or partial. Partial block restrictions can be returned with ApiQueryBlocks.

Bug: T197141
Change-Id: I76eb4cac4dc989c621a00a39996faebd0eb9892c
2018-10-24 16:26:32 +00:00
David Barratt
170c49d61c Update Special:BlockList to present Partial Block details from the database
The Special:BlockList page will be updated to show details from the Partial
Block within the "Block parameters" column. The format of the column will
change to make the details more readable.

Bug: T197143
Change-Id: Ibd79b049d93e427c2d541f8ef93005847482ef59
2018-10-24 16:26:06 +00:00
jenkins-bot
aff39bd7c9 Merge "Enforce partial blocks" 2018-10-24 03:15:39 +00:00
jenkins-bot
728d6e918c Merge "Add partial block details to block-log entries." 2018-10-24 01:45:25 +00:00
jenkins-bot
8da9405898 Merge "Update Special:Block to set Partial Blocks" 2018-10-24 01:45:18 +00:00
jenkins-bot
8f338c0e29 Merge "Add block restriction classes" 2018-10-24 01:28:36 +00:00
Dayllan Maza
d67121f6d3 Enforce partial blocks
Enforce partial blocks and display a slightly different block
notice depending on if the block is sitewide or not

Bug: T197117
Depends-On: I675316dddf272fd0d6172ecad3882160752bf780
Change-Id: I8a3635a4a04a33912eb139b7b13c4bd874183d31
2018-10-24 00:57:48 +00:00
Dayllan Maza
f24991c6ed Add partial block details to block-log entries.
Block information needs to be more detailed if a block is not
sitewide. With this change, page restrictions will be visible
as part of the block information in Special:Contributions,
Special:Block, and Special:Log and via API

Bug: T197108
Change-Id: I5d2ef606f709bdd60bf52e2a048890b0f6360fca
2018-10-24 00:47:27 +00:00
David Barratt
0813c46daa Update Special:Block to set Partial Blocks
Make the necessary UI changes to Special:Block in order to set/update
partial blocks.

Bug: T197109
Change-Id: Ib3067824b5dcbdd893ab1f165d169a35d0716cb2
2018-10-24 00:47:08 +00:00
Dayllan Maza
a562611e5b Add block restriction classes
Partial blocks logic will be used in multiple places. This
classes will group block restriction functionality to avoid
code duplication

Bug: T202036
Change-Id: I675316dddf272fd0d6172ecad3882160752bf780
2018-10-23 17:41:50 -07:00
C. Scott Ananian
fcbde8ae4e Make Language::hasVariant() more strict
In d59f27aeab we made
LanguageConverter::validateVariant() try harder to convert a variant
into an acceptable MediaWiki-internal form, looking at deprecated
codes and BCP 47 aliases.  However, this misled Language::hasVariant()
into thinking that bogus names (like all-uppercase strings) were
acceptable variant names, which then led exceptions when they were
passed to the various conversion methods.

This is a belt-and-suspenders patch for T207433 -- in that case we
shouldn't have created a Language object with code 'sr-cyrl' in the
first place, but once one was created we shouldn't have tried to
ask LanguageSr to convert texts to 'sr-cyrl'.  The latter problem
is fixed by this patch.

Bug: T207433
Change-Id: Id993bc7989144b5031a551662e8e492bd23f698a
2018-10-22 16:35:26 -04:00
Gergő Tisza
cfb62c605f Hard-deprecate LegacyHookPreAuthenticationProvider class
The hooks that used to be called by this class will be removed in
I24d6fa963. The only reason to keep this class around is that
someone might have added it to $wgAuthManagerConfig so removing
it would trigger class lookup failures, so make sure any use
of the class triggers a deprecation warning.

Change-Id: I9755288eda7461ecf3dcd35de2081fbb3eb04ae3
2018-10-22 12:14:19 -07:00
C. Scott Ananian
103a4f76dc Deprecate $wgFixArabicUnicode / $wgFixMalayalamUnicode
These were introduced in MW 1.17 and are always true in production.

They were useful to allow folks to defer title conversion, but it's
been a long time now.  We don't need to make this optional any more.

Change-Id: I65dcfe80dc3e1dfeb4d63924a8928655e012a20c
2018-10-21 21:55:39 -04:00
jenkins-bot
72e5b5af65 Merge "Use OutputPage::addWikiTextAsInterface() instead of untidy addWikiText()" 2018-10-22 01:49:58 +00:00
Bartosz Dziewoński
5f7002b907 During special page transclusion, save and restore context's WikiPage too
Setting the Title by calling setTitle clears the WikiPage, and the
next time getWikiPage() is called, it will be lazy-initialized to a
different instance of WikiPage.

This is mostly okay (the behavior has been like this for years and no
one noticed any problems), but it turns out that some extensions
(ConfirmEdit) use custom properties on the WikiPage object to pass
data between different hooks, which are lost when it's re-initialized.

Bug: T207065
Change-Id: I2881895f337bcfb1f86d5fc5a994fa9b0dcc768a
2018-10-19 22:19:52 +02:00
jenkins-bot
c44bba66c9 Merge "Watchlist: Commit after each batch watchlist insertion and removal" 2018-10-19 15:23:20 +00:00
Kosta Harlan
05b490bc4a Watchlist: Commit after each batch watchlist insertion and removal
With this change, adding large numbers (500+) of items to one's Watchlist via
Special:EditWatchlist/raw will no longer trigger DBPerformance warnings
for "max affected rows expectation not met". The same code mechanism is added
for bulk removal of watchlist items.

Bug: T171898
Depends-On: Ia0f496b8bfb2b68217d0f45f892045538494bfdc
Change-Id: I832b1843d1341b05227cdee2549bdcefa21eb300
2018-10-18 14:33:50 -04:00
jenkins-bot
837b96248d Merge "Revert "Introduce Special:RedirectExternal"" 2018-10-18 17:05:10 +00:00
Kosta Harlan
7e81d6f49e Revert "Introduce Special:RedirectExternal"
This reverts commit b83cf88837.

Reason for revert: Security concerns, needs some more nuance.

Change-Id: I5823c3da77accca9839f9632611315223e05351b
2018-10-18 16:18:20 +00:00
Max Semenik
ff2804804f Hard deprecate functionality replaced with random_bytes()
Deprecated in 1.32, no callers.

Change-Id: Id2d59c303fd60fab2b323af6cab137fdf74b5377
2018-10-17 19:57:52 -07:00
Brad Jorsch
c5a5b02240 Database: Allow selectFieldValues() to accept SQL fragments
The documentation says "This must be a valid SQL fragment", but as
written it breaks if given anything other than a field name. It's easy
enough to fix by adding an alias to the internal select() call.

Bug: T201781
Change-Id: I76428af6d3aadc266254fdb24109a0ac2db3761f
2018-10-17 22:21:40 +00:00
jenkins-bot
c75059dacb Merge "Introduce Special:RedirectExternal" 2018-10-17 22:12:52 +00:00
Kosta Harlan
b83cf88837 Introduce Special:RedirectExternal
Special:RedirectExternal is an unlisted special page that accepts a URL as
the first argument, and redirects the user to that page.
Example: Special:RedirectExternal/https://mediawiki.org

At the moment, this is intended to be used by the GrowthExperiments project in
order to track outbound visits to certain external links. But it could be
extended in the future to provide parameters for showing a message to the user
before redirecting, or explicitly requiring a user to click on the link, which
could help improve security when users follow on-wiki links to off-wiki sites.

Bug: T207115
Change-Id: I822af14a84569aab22249e2f16a662a60e60f76a
2018-10-17 14:52:09 -07:00
jenkins-bot
c27ea8dbd1 Merge "Allow getRevisionText to function without the text table." 2018-10-17 15:16:06 +00:00
daniel
7d8a959543 Allow getRevisionText to function without the text table.
Without this patch, getRevisionText would fail silently (by
returning false) when the text table no longer gets joined,
due to the switch to the new MCR schema.

Bug: T205808
Change-Id: Iffc25c82a5d2b865c28070c76156d39d390cc675
2018-10-17 10:54:39 -04:00
C. Scott Ananian
c0ed262053 Use OutputPage::addWikiTextAsInterface() instead of untidy addWikiText()
This change ensures that the output is tidy, and is necessary to support
future parsers which will not be able to produce untidy output.

Bug: T198214
Change-Id: I743f4185a03403f8d9b9db010ff1ee4e9342e062
2018-10-17 10:35:28 -04:00
jenkins-bot
82cc194a7d Merge "Add OutputPage::wrapWikiTextAsInterface() to safely wrap wikitext" 2018-10-17 05:00:54 +00:00
C. Scott Ananian
d404b76510 Add OutputPage::wrapWikiTextAsInterface() to safely wrap wikitext
This patch introduces a new method,
OutputPage::wrapWikiTextAsInterface(), which wraps the result of
OutputPage::addWikiTextAsInterface() in a tidy and robust way that
won't break if the wrapped message contains double newlines, extra
</div>, or other nasties.

This replaces a common unsafe pattern:
  $output->addWikiText( '<div class="..."' .... '</div>' );

Bug: T205624
Change-Id: I1040c7cf0ec1f5c4bef7c06d4486f50d85f2dc0f
2018-10-16 23:39:43 -04:00
jenkins-bot
2a13cc104a Merge "INSTALL, UPGRADE: Re-wrap to 80 chars and enforce" 2018-10-17 03:17:56 +00:00
James D. Forrester
a47aec961e INSTALL, UPGRADE: Re-wrap to 80 chars and enforce
Change-Id: Idabcc4db7a0b25448e7ad30641763e2b3e1a3160
2018-10-16 19:45:25 -07:00
C. Scott Ananian
4b1db1190b Tidy Message::parseAsBlock() by enabling tidy in MessageCache
We are incrementally removing places where the parser is used with
tidy disabled, since future parsers will not support such operation.

Bug: T198214
Change-Id: I0f417f75a49dfea873e9a2f44d81796a48b9f428
2018-10-17 02:43:07 +00:00
jenkins-bot
a1bbdcb629 Merge "rdbms: re-add DB domain sanity checks to LoadBalancer" 2018-10-16 23:54:38 +00:00
Aaron Schulz
b06f020217 rdbms: re-add DB domain sanity checks to LoadBalancer
Also clean up empty schema handling in DatabaseDomain

This reverts commit f23ac02f4f.

Bug: T193565
Change-Id: I95fde5c069f180ca888a023fade25ec81b846d44
2018-10-16 23:35:05 +00:00
Aaron Schulz
4fc5ba8bf8 messagecache: check overridable message array in getMsgFromNamespace()
Follow up to a3d6c1411d.

This avoids extra queries for messages that have a software defined value.

Bug: T193271
Change-Id: I25aa0e27200a0b417721cf1fbd34a82095405b89
2018-10-16 20:39:38 +00:00
jenkins-bot
9bfe012bdb Merge "API: Allow prop=info intestactions to return reasons" 2018-10-16 19:37:22 +00:00
jenkins-bot
b05aa05841 Merge "Migrate some wfWikiId() callers to getLocalDomainID()" 2018-10-16 19:37:18 +00:00
Brad Jorsch
20d18cf3cb
API: Allow prop=info intestactions to return reasons
T194585 raises a use case for callers to be able to know why an action
is not allowed. We can make that possible easily enough. The default
remains to return only a boolean.

This also deprecates inprop=readable in favor of intestactions=read,
since they both just return `$title->userCan( 'read', $user )`.

(ApiQueryInfoTest added by David Barratt)

Bug: T194585
Change-Id: Ib880f0605880eac776d816ea04e0c7ab9cfbaab1
Co-Authored-By: David Barratt <dbarratt@wikimedia.org>
2018-10-16 12:37:40 -04:00
Brad Jorsch
6698b7ea1d Add session_write_close() calls to SessionManager tests
PHP 7.3 doesn't like it if session_id() is called when the session has
been started, so we need to be sure to close it first in a few tests.

Bug: T207112
Change-Id: Ief36c1bb7b5c9066f158b5bb0d6d785a7f7ddd3c
2018-10-16 10:22:33 -04:00
Aaron Schulz
ebbccf1845 Migrate some wfWikiId() callers to getLocalDomainID()
Change-Id: I33fe222b7ca66babd61610febaebcf52d3806a7d
2018-10-15 23:58:49 -07:00
Brad Jorsch
6ff65e57bb API: Remove long-deprecated methods (and one class)
* ApiBase::profileIn() (deprecated in 1.25)
* ApiBase::profileOut() (deprecated in 1.25)
* ApiBase::safeProfileOut() (deprecated in 1.25)
* ApiBase::profileDBIn() (deprecated in 1.25)
* ApiBase::profileDBOut() (deprecated in 1.25)
* ApiBase::dieUsage() (deprecated in 1.29)
* ApiBase::dieUsageMsg() (deprecated in 1.29)
* ApiBase::dieUsageMsgOrDebug() (deprecated in 1.29)
* ApiBase::getErrorFromStatus() (deprecated in 1.29)
* ApiBase::parseMsg() (deprecated in 1.29)
* ApiBase::setWarning() (deprecated in 1.29)
* ApiPageSet::getInvalidTitles() (deprecated in 1.26)
* ApiQueryLogEvents::addLogParams() (deprecated in 1.25)
* ApiUsageException::getCodeString() (deprecated in 1.29)
* ApiUsageException::getMessageArray() (deprecated in 1.29)
* UsageException (deprecated in 1.29)

Change-Id: Iabb2589a29cc3b46624d31358f3a6bf7b3ccbd57
2018-10-15 16:37:04 -04:00
jenkins-bot
69d27cc0b6 Merge "Output only to stderr in unit tests" 2018-10-13 06:29:17 +00:00
jenkins-bot
6928652735 Merge "SlotDiffRenderer: add utility method for parameter type checks" 2018-10-13 05:27:16 +00:00
jenkins-bot
bce87740d7 Merge "Pass LBFactory to WatchedItemStore" 2018-10-12 21:48:54 +00:00
jenkins-bot
95e140cb71 Merge "HtmlTest: Perform multilingual tests" 2018-10-12 18:59:28 +00:00
Erik Bernhardson
9f28aa0709 Render namespace lists in the user's language
Asking users to select from a list that is in a namespace
other than their user language can be quite difficult.
Transition a number of use cases. This was applied via a flag
to avoid unexpectedly changing extensions also utilizing
the namespace selector.

Pages updated:
* Special:Search
* Special:Watchlist
* Special:RecentChanges
* Special:Contributions
* Special:Import
* Special:WhatLinksHere

Bug: T174057
Change-Id: I3fdac72179a124849ef7ad1e0e54eb66396c3c6e
2018-10-12 11:27:20 -07:00
Erik Bernhardson
1c6e6a4c91 HtmlTest: Perform multilingual tests
The tests here were only testing when user and content language
are the same, but the way things are rendered when they differ
is perhaps more interesting as it allows ensuring the two are used
in the correct places.

Change-Id: I357f50b082882fee485a95323d3a0a7cadb9a63c
2018-10-12 11:24:17 -07:00
C. Scott Ananian
6258e5e55c Deprecate $wgUseKeyHeader and OutputPage::getKeyHeader()
The `Key` header was a draft IETF specification which expired without
becoming a standard.  It does not appear to be in active use anywhere.

Change-Id: I3924a1b5ff428b107573d2827c40e4af8adaaeb1
2018-10-12 13:29:06 -04:00
Umherirrender
98c37e1549 Pass LBFactory to WatchedItemStore
Instead of passing the LoadBalancer and than get the LBFactory from the
service,
store the LBFactory on creation

Bug: T206601
Change-Id: I4c0d3712da591b2c5ddf2a65855d2cc9142417d2
2018-10-12 12:25:28 +00:00
jenkins-bot
4ddc1da854 Merge "Make MergeableUpdate jobs avoid the sub-queue so they can always merge" 2018-10-12 01:13:29 +00:00
Aaron Schulz
f61868f13d Make MergeableUpdate jobs avoid the sub-queue so they can always merge
Change-Id: I5b100fae29b785ab4524d165dad2e8ee46406b0c
2018-10-12 00:36:39 +00:00