Commit graph

7556 commits

Author SHA1 Message Date
jenkins-bot
3ea0a9068a Merge "preferences: Signature validation (lint errors, user links, nested subst)" 2020-06-24 22:14:57 +00:00
jenkins-bot
da6f6a2aa8 Merge "Add clock icon to expiring items in Special:Watchlist" 2020-06-24 17:34:50 +00:00
jenkins-bot
9b431ed169 Merge "Revision: Hard deprecation constructing with an array or an object" 2020-06-24 02:01:41 +00:00
jenkins-bot
4465bed839 Merge "Hard deprecate passing a Revision to WikiPage::prepareContentForEdit" 2020-06-24 00:01:54 +00:00
Bartosz Dziewoński
df7231ad89 preferences: Signature validation (lint errors, user links, nested subst)
Three new checks are now applied to user signatures in preferences:

* Disallow invalid HTML and lint errors (T140606)

  Since 15e0e9bb4b we can rely on Parsoid to check the signature for
  lint errors. (The old PHP Parser doesn't have this capability.)

  Most importantly, this will disallow unclosed HTML tags. Unclosed
  formatting tags like `<i>` (and also wikitext markup like `''`)
  could affect the entire page with the bad markup.

  New configuration variable $wgSignatureAllowedLintErrors is added
  to allow ignoring some errors. The default value ignores the
  'obsolete-tag' error (caused by HTML tags like `<font>` and `<tt>`.)

* Require a link to user page, talk page or contributions (T237700)

  Various tools don't work correctly when such a link is missing. For
  example, Echo notifications are not sent, DiscussionTools will not
  allow replying to these comments, English Wikipedia's SineBot treats
  these comments as unsigned.

  Such requirement has been present for a long time in many Wikimedia
  wikis' policies, but it was not enforced by software.

* Disallow "nested" substitution in signature (T230652)

  Clever abuse of "subst" markup and tildes allows users to save edits
  containing wikitext in which substitution occurs again when the page
  is next saved. Disallow this in signatures, at least.

New configuration variable $wgSignatureValidation is added to control
what we do about the result of the validation described above. The
options are:

* 'warning':
  Only displays a warning near the field on Special:Preferences if
  the current signature is invalid. Signatures can still be changed
  regardless of validity and will be used when signing comments.

* 'new':
  In addition to the above, if a user tries to change their signature,
  the new one must be valid. Existing invalid signatures are still
  used when signing comments.

* 'disallow':
  In addition to the above, existing invalid signatures are no longer
  used when signing comments.

Bug: T140606
Bug: T237700
Bug: T230652
Change-Id: I07c575c2d9d2afe7a89c4847d16ac044417297bf
2020-06-24 01:20:05 +02:00
jenkins-bot
cc23f1b68e Merge "Rename ContributionsLookup::getRevisionsByUser" 2020-06-23 20:10:33 +00:00
DannyS712
a903da26e1 Revision: Hard deprecation constructing with an array or an object
All remaining deployed Revision objects are created with RevisionRecords

Bug: T246284
Change-Id: I08a0a146750d6bf29d127bf2a3d636e46b1ef336
2020-06-23 19:31:18 +00:00
Timo Tijhof
15fa9559a9 rdbms: Simplify MWLBFactory::getLBFactoryClass
* Convert to a single map.
* Simplify source code.
* Remove deprecation warning for something we're not likely to
  remove. This was embedded into LocalSettings.php files and
  should generally just keep working and is easy and cheap to do.
  Also note clear why one half warned and the other half didn't
  (because that's the one we happen to use in prod.)
* Simplify the tests. A lot of the boilerplate was no longer needed.
* Reduce abstraction in the test as was was not more complex
  than the source it tests.

Change-Id: If3e7e25dbf3bb408581fc16ac8e556b44b1855ad
2020-06-23 17:29:38 +01:00
jenkins-bot
52f1bfa61b Merge "PageUpdater: create EditResult class" 2020-06-23 10:18:32 +00:00
Ostrzyciel
3d73bdf568 PageUpdater: create EditResult class
EditResult is an immutable object created during a page update by
the PageUpdater using a builder object, the EditResultBuilder.

EditResult is a container for information on how the edit
interacted with the page and previous revisions. It also aims to
provide a standardized way of describing reverts and reverted
edits. It is as simple as possible, with no dependencies on the DB
or global variables. Most of the logic is encapsulated in the
builder.

PageUpdater::getEditResult() replaces the following methods:
* getOriginalRevisionId()
* getUndidRevisionId()
They are both available in the EditResult object.

PageUpdater::markAsRevert() replaces
PageUpdater::setUndidRevisionId()

Bug: T254074
Change-Id: Ie04c38043d9c295552e488109436ec1df20bb2ca
2020-06-23 11:49:02 +02:00
Tim Starling
f7f6f0d700 Update LinkHolderArray tests for new HookContainer parameter
Change-Id: I63fc731ca1dbaef6f215279ee0b1788e735783df
2020-06-23 09:00:32 +10:00
jenkins-bot
a7dae830b3 Merge "Introduce wfDeprecatedMsg()" 2020-06-22 22:30:49 +00:00
Nikki Nikkhoui
b28ec056f9 Rename ContributionsLookup::getRevisionsByUser
ContributionsLookup::getRevisionsByUser() returns a ContributionSegment,
but the function name was misleading. Renamed to getContributions()
to more accurately reflect the return value.

Change-Id: Id94549f1f8d2dc5ca5769fcb4696a454fdb851ac
2020-06-22 14:58:13 -07:00
Roan Kattouw
8c6c1c9adc VueComponentParser: Use RemexHtml instead of PHP's HTML parser
This fixes an issue with HTML tags inside the <script> tag.
Remex also doesn't throw errors on attributes like @click, although it
does mangle them when producing DOM. To work around this, don't use DOM
serialization for the template HTML, but parse everything again using a
Remex parse+serialize pipeline that extracts the template and
(optionally) removes comments and strips whitespace.

One important effect of this change is that we'll have to forbid
self-closing tags in Vue templates, because Remex doesn't handle those
correctly (or rather, handles them *too* correctly). But on the up side,
we can now allow shorthands for v-bind/v-on/v-slot again.

Bug: T253334
Bug: T255587
Depends-On: I2253a2317187fe0d781ba5bfefab95e0f97d0a80
Change-Id: Id9a9728b7163601cc60bc587be07b70977d41970
2020-06-22 19:54:15 +00:00
Thiemo Kreuz
231bcef6af parser: Remove unused $query param from LinkHolderArray::makeHolder
We know it's never anything but an empty array:
https://codesearch.wmflabs.org/search/?q=makeHolder

Change-Id: Ibc230ec1a1a15a9a5dc61abe5b989a3391d671c1
2020-06-22 14:33:59 +00:00
Tim Starling
d459add63d Introduce wfDeprecatedMsg()
Deprecating something means to say something nasty about it, or to draw
its character into question. For example, "this function is lazy and good
for nothing". Deprecatory remarks by a developer are generally taken as a
warning that violence will soon be done against the function in question.
Other developers are thus warned to avoid associating with the deprecated
function.

However, since wfDeprecated() was introduced, it has become obvious that
the targets of deprecation are not limited to functions. Developers can
deprecate literally anything: a parameter, a return value, a file
format, Mondays, the concept of being, etc. wfDeprecated() requires
every deprecatory statement to begin with "use of", leading to some
awkward sentences. For example, one might say: "Use of your mouth to
cough without it being covered by your arm is deprecated since 2020."

So, introduce wfDeprecatedMsg(), which allows deprecation messages to be
specified in plain text, with the caller description being optionally
appended. Migrate incorrect or gramatically awkward uses of wfDeprecated()
to wfDeprecatedMsg().

Change-Id: Ib3dd2fe37677d98425d0f3692db5c9e988943ae8
2020-06-22 14:34:39 +10:00
Umherirrender
fd666afbb0 Use MediaWikiServices::getAuthManager instead of AuthManager::singleton
Change-Id: I92c31b963095eab751df9f8c1715e8e23b7e8485
2020-06-22 00:57:08 +00:00
jenkins-bot
ba443c4a93 Merge "WebRequest: Rewrite language handling in getAcceptLang()" 2020-06-20 18:09:33 +00:00
Umherirrender
f6617ba4b7 WebRequest: Rewrite language handling in getAcceptLang()
Change-Id: Ifcf0bc4c416d9b0a61d6ae82a184ba53b4f36016
2020-06-20 17:48:27 +00:00
jenkins-bot
f3b0ee76c5 Merge "Simplify overly complex data providers in HtmlTest" 2020-06-20 14:57:49 +00:00
Sam Wilson
93396e965e Add clock icon to expiring items in Special:Watchlist
If a changeslist item has an expiry date, add a grey clock icon
after the page title, with a tooltip indicating when the item
expires.

Bug: T250212
Change-Id: I38f8c85321cf257eeea8de5a3bd73bbc0b5ea393
2020-06-19 05:48:21 +08:00
DannyS712
a9f02c1cf7 Hard deprecate passing a Revision to WikiPage::prepareContentForEdit
Bug: T255759
Change-Id: I21939c52afbdd408d33af2ba6d7d202bd46b17f4
2020-06-18 10:28:04 +00:00
jenkins-bot
bd4065ed9b Merge "WikiPage::doEditUpdates - accept a RevisionRecord object" 2020-06-18 01:24:33 +00:00
jenkins-bot
a5b4b456e2 Merge "Replace last usage, hard deprecate WikiPage::updateIfNewerOn" 2020-06-17 18:35:47 +00:00
suecarmol
fd14eb2d0d Add getExpiryInDays function in WatchedItem
Add a function that calculated the number of days remaining before a
watched item expires. This function will be used in several places, like
the watchstar tooltip and the clock icon that will appear on
Special:Watchlist on pages that are being temporarily watched.

Bug: T253936
Change-Id: I5b50a6707fb6a8e5ad868b5c30917027266ab82a
2020-06-16 19:58:34 -05:00
jenkins-bot
8c7d759195 Merge "Fix visibility of setUp/tearDown" 2020-06-16 19:43:12 +00:00
jenkins-bot
2101ed6c31 Merge "upload: Modernize callback code to make use of PHP7 syntax" 2020-06-16 19:37:15 +00:00
Thiemo Kreuz
5f3a92385b Fix visibility of setUp/tearDown
Change-Id: I636be48eb9f713680abac35d46091f7b49374696
2020-06-16 21:02:05 +02:00
jenkins-bot
2d34500f59 Merge "UserContributions endpoint: filter suppressed revisions" 2020-06-16 18:33:33 +00:00
daniel
96aacab20b UserContributions endpoint: filter suppressed revisions
ContributionsLookup needs to have the acting user (the authority) passde
in explicitly, so suppressed user contributions can be filtered according
to the user's permissions.

Bug: T252202
Change-Id: I94098f87ae45cd4e1db4a7168bf6e9478e9e32fc
2020-06-16 08:20:32 -07:00
jenkins-bot
1e6fa3e186 Merge "Introduce BlockPermissionChecker service for validating block targets" 2020-06-16 15:06:32 +00:00
jenkins-bot
d01b655ee2 Merge "Remove deprecated PasswordCannotBePopular" 2020-06-16 14:07:42 +00:00
DannyS712
538cfa4010 WikiPage::doEditUpdates - accept a RevisionRecord object
Passing a Revision is hard deprecated

Bug: T249563
Change-Id: Ic3f8fe9ed05820174b9cc3e9d2f4d17718947da0
2020-06-16 02:06:25 +00:00
DannyS712
522e71acc4 Replace last usage, hard deprecate WikiPage::updateIfNewerOn
Bug: T250318
Change-Id: I1c3da36cb67258b58680011e0a3e5cee6a167681
2020-06-16 02:04:58 +00:00
jenkins-bot
548b53e492 Merge "Add PageArchive::getRevisionRecordByTimestamp" 2020-06-16 00:53:08 +00:00
DannyS712
44945be0a5 Hard deprecate calling ParserOptions::newCanonical with no parameters
Falls back to $wgUser
No remaining deployed uses in MW 1.35+

Bug: T246861
Change-Id: If4304de546457fe0a96a6ac8d705a70c480c6fae
2020-06-15 23:11:45 +00:00
DannyS712
dd938a8b5a Add PageArchive::getRevisionRecordByTimestamp
For internal use only
Allows deprecating PageArchive::getRevision

Bug: T249982
Change-Id: I0e10c1b6c7f56af9340f42d58ec4e8699e247be4
2020-06-15 23:02:50 +00:00
Reedy
a26c1c8e59 Remove deprecated PasswordCannotBePopular
Change-Id: I77432ef0257c0dc8aa7c26e075616592e639bfec
2020-06-15 21:57:25 +00:00
jenkins-bot
08954c6303 Merge "MultiHttpClient: Reduce the default timeout from 900 to 30" 2020-06-15 20:18:17 +00:00
jenkins-bot
4852806586 Merge "REST /me/contributions: implement backwards paging" 2020-06-15 19:17:17 +00:00
jenkins-bot
b26f59c8a9 Merge "Deprecate PasswordNotInLargeBlacklist" 2020-06-15 19:16:50 +00:00
Reedy
a67a1bc923 Deprecate PasswordNotInLargeBlacklist
Bug: T254799
Change-Id: If5a23dc2cbe675bac8cc4979bba8c3d4527997a0
2020-06-15 19:54:40 +01:00
daniel
5601152836 REST /me/contributions: implement backwards paging
This is part of a chain of patches that implement the user
contributions endpoint. This patch adds the ability to navigate
towards newer newer contributions from a response listign older
contributions.

Bug: T252202
Change-Id: I54c43f3c7bd5d2fa55431eda733291a7067bfc75
2020-06-15 11:41:36 -07:00
jenkins-bot
c41566413b Merge "skins: Port SkinFallback and SkinApiOutput to a generic SkinMustache class" 2020-06-15 18:13:50 +00:00
jdlrobson
26d5f78f84 skins: Port SkinFallback and SkinApiOutput to a generic SkinMustache class
The new SkinMustache class is based on the emerging class in Vector.
Having this in core, will allow Vector to make use of this class
immediately and provide a minimal generic mechanism going forward
for rendering skins using Mustache. For now, I've fleshed out the minimum
possible data in getTemplateData which are based on existing functions in
Vector.

The Skin class now takes a generic options parameter which allows
registration of a skin using the SkinMustache class with a templateDirectory
option pointing to the associated template. A `styles` option can be passed
to define stylesheets that should be associated with the skin.

The SkinApi and SkinFallback classes are reduced significantly.

There are no known uses of SkinApiTemplate and it is thus removed.

SkinFallbackTemplate is removed and its functions copied across to
SkinFallback

End user changes:
* The fallback skin no longer prints the confusing warning message if the default
  skin is setup incorrectly. Previously viewing the fallback skin with useskin
  indicated that wgDefaultSkin was not set correctly which was misleading and confusing.
* Factory functions now receive skin options as a second parameter and the service as a
  first - this is due to how ObjectFactory handles the extraArgs key for 'factory' key
  - placing it at the beginning.

Bug: T254048
Change-Id: Ibbabd1d0f26efebf8f8ff068966685dc2191c527
2020-06-15 10:51:31 -07:00
Tim Starling
b2a8e26cda MultiHttpClient: Reduce the default timeout from 900 to 30
Per my caller survey in the linked bug, it is hard to find a caller
which actually needs a long timeout, but many callers used the default
timeout without reviewing it. The default was increased from 300 to 900
as a quick hack to fix T226979, but that has now been fixed by overriding
the timeout in SwiftFileBackend specifically.

Reduce the default to 30 since that is a more reasonable value to use when
serving web requests. Since everything that previously used this default
was migrated to use HttpRequestFactory::createMultiClient(), the timeout
for them was already reduced from 900 to 25 with no apparent ill
effects. This cleanup change should have no production impact.

Bug: T245170
Change-Id: Id6029afa4e3f1c6551cd823c3b0def01afcdc571
2020-06-15 15:34:13 +10:00
Aaron Schulz
55d147e4bb objectcache: Split out BagOStuffTestBase class for easier subclassing
Create a simple APCUBagOStuff subclass and also fix
APCUBagOStuff::incrWithInit() default $init value.

Change-Id: If84963fe7dcfedd6edebfb8785235263e0868ece
2020-06-13 20:15:23 +00:00
jenkins-bot
a2b3528b39 Merge "Add a test for WikiPage::factory" 2020-06-13 10:03:51 +00:00
ArtBaltai
32f518baa2 Add a test for WikiPage::factory
Bug: T239975
Change-Id: I76366890e99c7ff4f284c69327e17a51072c587b
2020-06-13 09:44:28 +00:00
jenkins-bot
1bf3db2214 Merge "Use 'list of allowed attributes' in Sanitizer, instead of 'whitelist'" 2020-06-12 23:37:20 +00:00