Commit graph

397 commits

Author SHA1 Message Date
jenkins-bot
334eb94f20 Merge "Use MediaWikiServices::getStatsdDataFactory" 2020-04-17 01:03:56 +00:00
Ed Sanders
40fdd9b6bc Apply editfont preference to diff rendering
Bug: T250393
Change-Id: I07dd6f78fdd6b07b349c0d08942a374d4d855af5
2020-04-16 14:53:59 +01:00
Umherirrender
62747a98cc Use MediaWikiServices::getStatsdDataFactory
Change-Id: I219225ad8232c0726ea18375e43aad6b524d67d0
2020-04-15 21:52:47 +02:00
DannyS712
fda65e7a27 Replace remaining uses and hard deprecate Revision::newFromArchiveRow
Bug: T248772
Change-Id: I44d0573b8af14d55e1c7423197dfae3cd55d7417
2020-04-01 20:18:33 +00:00
DannyS712
1d4df4f221 Hard deprecate Revision::getQueryInfo and ::getArchiveQueryInfo
Bug: T246284
Change-Id: I708f265aac3016e34d02936cf5dff98a3036ef0f
2020-03-26 23:53:19 +00:00
DannyS712
78bc3ae255 Hard deprecate Revision::userCan
Replace remaining uses outside of tests, hide deprecated in tests

Bug: T247259
Change-Id: I91dfb46ed6864ee89d968aea8ec93b5ea2f8389e
2020-03-11 02:10:52 +00:00
DannyS712
909f0bef6e Replace calls to Title::getUserPermissionsErrors (part 5)
This does //not// fix all calls in core.

Bug: T244929
Change-Id: I02ffcca31fa0bdc6bffddf21e82f4ff5e9ab5374
2020-02-26 03:00:33 +00:00
jenkins-bot
4dbc276487 Merge "Remove ArticleContentViewCustom hook, deprecated and unused" 2020-02-13 05:13:11 +00:00
ArtBaltai
30e54b3962 Introduce ContentHandlerFactory
Added:
- ContentHandlerFactory
Tests:
- PHPUnit
Changed
- Calls of changed and deprecated
- DI for some service/api
Deprecated:
- ContentHandler::* then similar to ContentHandlerFactory
- ContentHandler::getForTitle
- ContentHandler::$handlers

Bug: T235165
Change-Id: I59246938c7ad7b3e70e46c9e698708ef9bc672c6
2020-02-07 00:53:51 +03:00
DannyS712
f14fad3538 Remove ArticleContentViewCustom hook, deprecated and unused
Bug: T241351
Change-Id: Ie37ed9265511e3051ea60c6898febb567d5283df
2020-02-06 19:55:16 +00:00
Matěj Suchánek
3ce567d8ac Replace Linker::link usage with LinkRenderer in includes
Needs one unit test to become integration again :(

Bug: T149346
Change-Id: I62fc566dfb542939431fd4a135c05e0924c70dbf
2020-01-11 11:20:17 +01:00
James D. Forrester
0958a0bce4 Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNull
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
2020-01-10 14:17:13 -08:00
jenkins-bot
554feecbb4 Merge "Inline diffs upstreamed from MobileFrontend to core." 2019-12-08 09:01:48 +00:00
jdlrobson
1c2de3d397 Inline diffs upstreamed from MobileFrontend to core.
A new inline mode is provided for diffs.
It is only available when wikidiff2 is installed.
There is no PHP implementation (one can be added later if
necessary)

For now, it is accessed by passing diff-type as a query string parameter
e.g ?diff-type=inline
A control for switching between the two is added as a follow up.
see Ie9bb17789d90b7492559782021937f3f3e4356f8

* The final method getSlotDiffRenderer now takes a second parameter
options
* The method `getSlotDiffRendererInternal` is deprecated and
replaced with the more flexible `getSlotDiffRendererWithOptions`
This has potential to be a breaking change but is unlikely to impact
any existing clients.

Note: PHP implementation can be added later if necessary

Bug: T117279
Change-Id: I4f81c8ccf253dd4aa6cf43c3fad257b4b0dd1ebd
2019-12-06 01:08:10 +00:00
Brad Jorsch
152376376e Remove hacks for lack of index on rc_this_oldid
In several places, we're including rc_timestamp or other fields in a
query selecting on rc_this_oldid because there was historically no index
on the column.

The needed index was created by I0ccfd26d and deployed by T202167, so
let's remove the hacks.

Bug: T139012
Bug: T239772
Change-Id: Ic99760075bde6603c9f2ab3ee262f5a2878205c7
2019-12-04 16:00:02 -05:00
Brad Jorsch
a8cbf85d1d DifferenceEngine: Don't try counting revs between deleted revs with different page IDs
Recent changes have caused the method for counting the number of
revisions in between the two sides of a diff to throw an error when the
revisions have different page IDs.

This blows up some cases of trying to get a difference between deleted
revisions, as the page IDs on the deleted revisions might not match
and/or might not match the current ID returned by the Title object.

Bug: T237709
Change-Id: I415f7ebb57fa4e879396b0db0e3a79edc2880be5
2019-11-20 13:21:46 -05:00
jenkins-bot
570c19f1f5 Merge "Don't calculate amount of inbetween revisions for MCR undo" 2019-11-06 14:52:15 +00:00
jenkins-bot
6af95728ef Merge "Add $wgDiffEngine" 2019-11-05 22:25:15 +00:00
Brad Jorsch
f3058c81b9 Add $wgDiffEngine
The immediate use case is for testing, where some tests need to use the
PHP implementation even when wikidiff2 is installed.

Bug: T237049
Change-Id: I41dc4c0933429065d7638f518ec31f0a056afc41
2019-11-05 10:38:52 -05:00
Petr Pchelko
d951e6ccb6 REST: Add 'from' and 'to' parameters to historycount endpoint.
* Add 'from' and 'to' query parameters to history count endpoint,
in case we are counting 'edits'. The support for parameters will be
expanded in the future, given that 'editors' is on the way.

* Refactor RevisionStore::countRevisionsBetween to be able to omit
starting or ending revision.

Bug: T235666
Change-Id: I1fc3f2d4e422f17ccfc99664ea35e210c13ade5f
2019-11-04 15:21:22 -08:00
Matthias Mullie
7fe98fb56c Don't calculate amount of inbetween revisions for MCR undo
Ib404d29a662de7736b50a1d07380f651d332ad6b introduced a new sanity
check in RevisionStore::countRevisionsBetween to check whether
the ids are not null (otherwise, they're considered unsaved)

For MCR undo actions, diffs could be generated for unsaved revisions
(where one revision is a not yet pre-existing combination where
some slots remain unchanged, but some slot gets undone)

The existing if statement here was already trying to guard against
unsaved revisions, but was doing so in a way different from the
new checks in RevisionStore::countRevisionsBetween - even though this
was documented to only diff saved revisions, it wasn't checking
thoroughly enough, and an exception would crop up later.

Bug: T236320
Change-Id: If34766675f50b67d8b0788a6eab07d8d4e6fe183
2019-11-04 11:17:37 +01:00
jenkins-bot
678157c01a Merge "Permissioning refactor of DifferenceEngine" 2019-11-01 04:02:40 +00:00
jdlrobson
93575bf125 Permissioning refactor of DifferenceEngine
In preparation for adding the MobileFrontend DifferenceEngine
some light refactoring of the uber-function showDiffPage is
required.

This begins by extracting several helper functions that will
be used inside the new InlineDifferenceEngine class (and addressing
the FIXME's inside MobileFrontend's code.

Hopefully the new code is much more readable by explaining the
complicated logic that lives inside the showDiff function

Bug: T117279
Change-Id: Iede69d1b87ac100472087584968df2d479e13f60
2019-10-30 14:48:53 -07:00
Yaron Koren
b10d0fa09d Fix for ArticleRevisionViewCustom hook in DifferenceEngine.php
Was missing a parameter, which actually made this hook unusable.

Bug: T236628
Change-Id: I6e260cd49f7083f34d4218712edf7d91d2f11ee9
2019-10-28 15:43:38 +00:00
jenkins-bot
78a2b8f485 Merge "Fix new phan errors, part 5" 2019-10-20 01:39:44 +00:00
Daimona Eaytoy
d3252fc870 Fix new phan errors, part 5
Some of the errors are suppressed because they're phan false positives.
The idea behind this is that they'll be fixed in a future version of
phan, and we'll just have to remove the suppressions.

Note: I'm disabling UnusedPluginSuppression so that we can start suppressing
issues even if they're still disabled. The sniff should be re-enabled
as soon as we upgrade phan.

Bug: T231636
Change-Id: I0f7fa06a9e03fbb86c7a5eb6e50a850bb258a7f7
2019-10-18 20:45:53 +00:00
Petr Pchelko
6eb67c752e Move countRevisionsBetween from Title to RevisionStore
Bug: T235666
Change-Id: Ib404d29a662de7736b50a1d07380f651d332ad6b
2019-10-17 08:02:26 -07:00
Daimona Eaytoy
e3412efac3 Unsuppress PhanParamReqAfterOpt, use PHP71 nullable types
These were all checked with codesearch to ensure nothing is overriding
these methods.
For the most part, I've updated the signature to use nullable types; for
two Pager's, I've just made all parameters non-optional, because you're
already forced to pass them with a required parameter at the end.

Bug: T231636
Change-Id: Ie047891f55fcd322039194cfa9a8549e4f1f6f14
2019-10-10 11:53:58 +02:00
James D. Forrester
5b3bbd5ade Drop strings for wgExternalDiffEngine, deprecated in 1.27 and 1.32
Also move the 'unit' test into integration, given it tests code
using globals.

Change-Id: Ie039cae9b5d2870c18a6deefec9a73de522dd847
2019-10-03 22:09:38 +00:00
Petr Pchelko
56c21d059c Remove usages of Title::get{Previous,Next}RevisionId
The methods were deprecated since 1.34.

Change-Id: Ib95ac1ba36a8ffd6b71ed67642d8abb2e3538bae
2019-09-13 09:49:13 -07:00
Daimona Eaytoy
cbf0404caa DifferenceEngine: Use quickUserCan for display of rollback link
Title::userCan is too expensive for this, as it queries the master DB
just to decide whether a link should be shown.
The DBPerformance warning for this is seen roughly 8000 times per day on
logstash.

Bug: T232258
Change-Id: I33eab493273ed4790645e338c83993043e76e1d7
2019-09-09 15:30:44 +00:00
daniel
8041b1ff89 DifferenceEngine: show undo links for non-text content
In Ia94521b78 I introduced code that would suppress undo links in diffs
of non-textual content. However, extensions that define non-textual
content, such as Wikibase, may override action handles to provide undo
functionality. So my reasoning for removing these links was flawed.

Bug: T232214
Change-Id: I0316d8c0683b0782b9940e0e1e8f70d5bcb6b468
2019-09-06 15:58:31 +02:00
Petr Pchelko
f1914810a7 Remove usages of Title::quickUserCan
Change-Id: Ifa53e0ec800e23dc4184d133a100fb9378dfee9e
2019-08-29 11:48:30 -07:00
daniel
6906a7728c Add UnknownContentHandler.
UnknownContentHandler can be configued to handle models that
belong to extensions that have been undeployed:

  $wgContentHandlers['xyzzy'] = 'UnknownContentHandler';

This way, no errors will be thrown when trying to access
pages with the unsupported model. Instead, an error message is
shown, and editing is prevented.

This patch also improves handling of non-editable content in
EditPage and in DifferenceEngine.

Bug: T220608
Change-Id: Ia94521b786c0a5225a674e4dc3cb6761a723d75b
2019-08-29 10:43:11 +00:00
Petr Pchelko
1d286560d2 Replace User::isAllowed with PermissionManager.
Covers root includes, actions, api, block, changes,
changetags, diff and PermissionManager itself.

Bug: T220191
Change-Id: Ic027d32f5dd8f4c74865df0c8a9fcf91123c889c
2019-08-20 14:43:51 -07:00
Umherirrender
2664eeb632 Clean up spacing of doc comments
Align the doc stars and normalize start and end tokens

Change-Id: Ib0d92e128e7b882bb5b838bd00c74fc16ef14303
2019-08-05 22:29:50 +00:00
jdlrobson
6b3a9c0521 Don't double wrap rollback links
Bug: T228766
Change-Id: Iaca54e1ceefc73815fe3d9898ca490b74d11dac6
2019-07-23 12:07:47 -07:00
Derick Alangi
c5b7101a15 Avoid usage of deprecated Revision::* constants
Change-Id: Ibb55d5a01f997f9c79bcf2f5e09d4f02d22152d2
2019-07-21 17:26:48 +01:00
Derick Alangi
339211a1ea Avoid usage of deprecated Revision::* constants, use RevisionRecord
Change-Id: I872fc89e5c02dd6a3ae9cd7e76640b95dc33f514
2019-07-21 15:03:03 +01:00
Máté Szabó
6420c79320 Migrate remaining usages of Title::userCan() to PermissionManager
T208768 introduced the PermissionManager service that can now be used
for page specific permission checks. This change replaces remaining calls
to Title::userCan() with the new service in MediaWiki core.

Bug: T220191
Change-Id: Ie45e0cb6aa49a8c66147b470946161fc18160fc1
2019-06-03 13:03:46 +02:00
Adam Wight
2eec94991b Deprecate $wgWikiDiff2MovedParagraphDetectionCutoff
Bug: T194272
Change-Id: I174192dc2b91409e023c06b054bc1bba8bfc571f
2019-05-22 15:42:20 +02:00
Derick Alangi
7f5a204e42 diff: Wrap condition around brackets for more readability
Also, as I'm touching this line, fixing the is_null() check to
finally clean this entire line up once and for all.

Change-Id: I573972519796f3eedaf950fa953b9df6b6824379
2019-04-13 19:18:57 +01:00
Fomafix
14d9e80ba4 Fix order of @var parameter in PHP
Replace

 @var $foo type

by

 @var type $foo

Change-Id: Iec8b90ffea4028a1005daef422b7c4ec38c2715f
2019-04-08 18:37:56 +02:00
Aaron Schulz
a26eee40e0 Avoid use of deprecated ObjectCache::getMainWANInstance method
Change-Id: I429e68c8642a00afa812f5ae900c1fb4f8308528
2019-03-01 02:38:55 +00:00
jdlrobson
0e1edec723 Apply the pseudo-css selector rules to diff and changelist pages
The styles that we are applying on changelist pages should also
apply on diff pages. This generalises the rules into a new
module.

To avoid problems with cached HTML mediawiki.special.changeslist
temporarily loads resources/src/mediawiki.interface.helpers.styles.
This will be removed after the change has been in production for a
week.

Bug: T212613
Change-Id: I6aad563e48f41c783df8b176a4f437e60a1255cc
2019-02-21 15:54:46 -08:00
Brad Jorsch
02195c7a81 DifferenceEngine: Allow cache hits for empty diffs
PHP considers the empty string as falsey, so check for a string
result instead.

Bug: T216554
Change-Id: I3b7d1199acbfede8a95761c5cb1c797b9a3d64cb
2019-02-19 15:55:44 -05:00
Fomafix
04370ccb08 Remove double check of $oldRevision
The

 if ( $oldRevision )

above already do the same check.

Change-Id: Ibbd5b6209d67f195b6b7431bccc31c4401f0a799
2019-02-08 14:05:13 +01:00
Kunal Mehta
cc5d9a92a2 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I66b1775b7c1d36076d9ca78cbeb42787a743f2aa
2019-02-07 18:39:42 +00:00
Thiemo Kreuz
4b71077646 Remove a few obscure "done" and "empty" comments
These don't add any knowledge to what is already obvious from the
code, I find.

Change-Id: Ia613b6a059f78dbeefdfd020899bd1a6e239a731
2019-01-30 20:35:14 +00:00
Umherirrender
ca06a63f3b Use ContextSource::getConfig instead of globals
Change-Id: I26dd9b1efc0292bbe0044d823f639a2ac5e339dd
2019-01-01 11:20:57 +00:00