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
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
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
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
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
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
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
There is some code duplication that should be factored into ChangeTags
but it can be done later.
Bug: T209525
Change-Id: Ie929d541754634a7be15cbb87da1d9db1f05bf0c
These new classes provide a mechanism for defining the
behavior of slots, like the content models it supports.
This acts as an extension point for extensions that need
to define custom slots, like the MediaInfo extension
for the SDC project.
Bug: T194046
Change-Id: Ia20c98eee819293199e541be75b5521f6413bc2f
During development a lot of classes were placed in MediaWiki\Storage\.
The precedent set would mean that every class relating to something
stored in a database table, plus all related value classes and such,
would go into that namespace.
Let's put them into MediaWiki\Revision\ instead. Then future classes
related to the 'page' table can go into MediaWiki\Page\, future classes
related to the 'user' table can go into MediaWiki\User\, and so on.
Note I didn't move DerivedPageDataUpdater, PageUpdateException,
PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept
long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\
instead.
Bug: T204158
Change-Id: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
There was a conditional that was documented to make the method bail out
if the current revision was unsaved, but it was missing the actual return
statement.
Note that preview code in EditPage does not use
DifferenceEngine::renderNewRevision.
Change-Id: I86a25e9464435ac17c72f78f7ce1f354adf3d055
The main external change here is that it can now return diffs per slot,
and the various parameters for providing text are deprecated in favor of
templated per-slot versions.
Also, this deprecates the 'fromsection' and 'tosection' behavior
introduced for T183823 (extracting a section's content for the diff) in
favor of the more logical behavior requested in T185723 (expanding
'fromtext-{slot}'/'totext-{slot}' as if for a section edit).
Bug: T200569
Bug: T183823
Bug: T185723
Change-Id: I700edfa766bbc320887f2e0b7507fcdb11e72cdc
Move logic for rendering a diff between two content objects out of
DifferenceEngine, into a new SlotDiffRenderer class. Make
DifferenceEngine use multiple SlotDiffRenderers, one per slot.
This separates the class tree for changing high-level diff properties
such as the header or the revision selection method (same as before:
subclass DifferenceEngine and override ContentHandler::getDiffEngineClass
or implement GetDifferenceEngine) and the one for changing the actual
diff rendering for a given content type (subclass SlotDiffRenderer and
override ContentHandler::getSlotDiffRenderer or implement
GetSlotDiffRenderer). To keep B/C, when SlotDiffRenderer is not overridden
for a given content type but DifferenceEngine is, that DifferenceEngine
will be used instead.
The weak point of the scheme is overriding the DifferenceEngine methods
passing control to the SlotDiffRenderers (the ones calling
getDifferenceEngines), without calling the parent. These are:
showDiffStyle, getDiffBody, getDiffBodyCacheKeyParams. Extensions doing
that will probably break in unpredictable ways (most likely, only
showing the main slot diff). Nothing in gerrit does it, at least.
A new GetSlotDiffRenderer hook is added to modify rendering for content
models not owned by the extension, much like how GetDifferenceEngine
works.
Also deprecates public access to mNewRev/mOldRev and creates public
getters instead. DifferenceEngine never supported external changes to
those properties, this just acknowledges it.
Bug: T194731
Change-Id: I2f8a9dbebd2290b7feafb20e2bb2a2693e18ba11
Depends-On: I04e885a33bfce5bccc807b9bcfe1eaa577a9fd47
Depends-On: I203d8895bf436b7fee53fe4718dede8a3b1768bc
The value 'wikidiff2' for $wgExternalDiffEngine was obsoleted in
I32b670ebf6 but not formally deprecated. Let's do that now.
Change-Id: Ie5ccd3895544cf393885b84d38eca6003c79e8ad
Depends-On: I33c6207cfc5fb66987d31818bc27055f597d28c7
These had no business being public in the first place and there is
no usage in Gerrit. In case something does use them, it will probably
be broken by the refactoring that's soon to come, so the deprecation
warning makes it easier to figure out where the problem lies.
Change-Id: I72ba5cfbf91f4af16028ba4f8619df6a7168a786
These methods returned a boolean indicating whether loading the
data was successful, but then always returned true on subsequent
calls. Fix that.
This changes public methods but there's no usage in Gerrit (some
of them are called but the return value is ignored), no use case
for a caller to care, and the previous behavior has been
undocumented and unreliable, so there is no deprecation period.
Change-Id: I3998aeea66972f33274e05fa5a74d6ce7fdc56b6
Also move the comment about the default value from the setter to the
getter.
Change-Id: I2e1bd29db986dfa92d41a876340a6aa59ac6670d
Depends-On: I8b573866c2de9b21d3849f02269c1b9ca4f62aba
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of
the HTML/XML entities   or   or .
With the UTF-8 character the generated HTML is shorter and better to read.
Also change the special value for the label in HTMLForm from   to
U+00A0 but also support   for backward compability.
Bug: T154300
Change-Id: I882599ac1120789bb4e524c4394870680caca4f4
Uses new PHP 5.6 syntax like ...parameter unpacking and
calling anything looking like a callback to make the code more readable.
There are much more occurrences but this commit is intentionally limited
to an easily reviewable size.
Change-Id: Idcec077ef3fdf029b632cceafd0150851ad723e3
The siteinfo API response's 'writeapi' value is now hard-set to true,
as are the ResourceLoader variables wgEnableAPI and wgEnableWriteAPI,
to be deprecated later.
Bug: T115414
Change-Id: I54ff9428b247ba203d67aba079149393f323d5a9
This also removes all the in-core calls that had been kept for the
benefit of extensions, and causes them to not have any effect since
anything that had been calling them was already either a no-op or will
probably be broken now that nothing in core is setting or checking the
flags.
Change-Id: Id22c1a5a6d6a249debb14063ae3f8838d105b634